File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6262
6363 # External packages
6464
65- 'widget_tweaks' ,
6665 'rest_framework' ,
6766 'rest_framework.authtoken' ,
6867
Original file line number Diff line number Diff line change 55
66class ScoreForm (forms .Form ):
77 leaderboard = None
8- score = forms .IntegerField (required = True )
9- source = forms .CharField (required = True )
10- clean_code = forms .CharField (max_length = 600 , required = True )
8+ score = forms .IntegerField (
9+ required = True ,
10+ widget = forms .NumberInput (attrs = {"class" : "form-control" , "placeholder" : "Score" }),
11+ )
12+ source = forms .CharField (
13+ required = True ,
14+ widget = forms .TextInput (
15+ attrs = {"class" : "form-control" , "placeholder" : "Url to image or video" }
16+ ),
17+ )
18+ clean_code = forms .CharField (
19+ max_length = 600 ,
20+ required = True ,
21+ widget = forms .TextInput (
22+ attrs = {
23+ "class" : "form-control" ,
24+ "placeholder" : "Clean code (automatically copied to your clipboard after the match)" ,
25+ }
26+ ),
27+ )
1128
1229
1330def get_score_form (game_slug : str ) -> Type [ScoreForm ]:
1431 class GameScoreForm (ScoreForm ):
15- leaderboard = forms .ModelChoiceField (required = True ,
16- queryset = models .Leaderboard .objects .filter (
17- game_slug = game_slug ),
18- )
32+ leaderboard = forms .ModelChoiceField (
33+ required = True ,
34+ queryset = models .Leaderboard .objects .filter (game_slug = game_slug ),
35+ widget = forms .Select (attrs = {"class" : "form-control" }),
36+ )
1937 return GameScoreForm
Original file line number Diff line number Diff line change @@ -10,21 +10,20 @@ <h1 class="display-4 fw-normal">Submit a New Score!</h1>
1010< div class ="position-relative overflow-hidden p-3 p-md-5 m-md-3 text-center bg-dark ">
1111 < div class = "form-group ">
1212 < form method ="post " enctype ="multipart/form-data ">
13- {% load widget_tweaks %}
1413 {% csrf_token %}
1514 {{form.errors}}
1615 < div class ="row ">
1716 < div class ="col ">
18- {% render_field form.leaderboard class+="form-control" placeholder="Robot" % }
17+ {{ form.leaderboard } }
1918 </ div >
2019 < div class ="col ">
21- {% render_field form.score class+="form-control" placeholder="Score" % }
20+ {{ form.score } }
2221 </ div >
2322 </ div >
2423 < br >
25- {% render_field form.source class+="form-control" placeholder="Url to image or video" % }
24+ {{ form.source } }
2625 < br >
27- {% render_field form.clean_code class+="form-control" placeholder="Clean code (automatically copied to your clipboard after the match)" % }
26+ {{ form.clean_code } }
2827 < br >
2928 < p style ="color:white ">
3029 Screenshots/videos and clean codes are required for all submissions. YouTube videos are strongly preferred over screenshots.
@@ -34,4 +33,4 @@ <h1 class="display-4 fw-normal">Submit a New Score!</h1>
3433 </ form >
3534 </ div >
3635</ div >
37- {% endblock %}
36+ {% endblock %}
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ <h1>{{request.user.get_full_name}}</h1>
1313 < br /> If you recently changed your Discord profile, you need to reauthenticate with Discord by < a style ="color:#fff; ; " href ="/reauth "> clicking here</ a > .</ p >
1414 < br />
1515 < form method ="POST " action ="">
16- {% load widget_tweaks %}
1716 {% csrf_token %}
1817 Set Website Display Name:
1918 < div class ="input-group mb-3 ">
@@ -24,4 +23,4 @@ <h1>{{request.user.get_full_name}}</h1>
2423 < p id ="messages "> {{message}}</ p >
2524 {% endfor %}
2625</ div >
27- {% endblock %}
26+ {% endblock %}
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ certifi==2024.7.4
55charset-normalizer == 2.0.12
66distlib == 0.3.4
77Django >= 5.0 ,< 6.0
8- django-widget-tweaks == 1.4.12
98djangorestframework >= 3.15.0 ,< 4.0
109idna == 3.3
1110pycodestyle == 2.8.0
@@ -21,4 +20,3 @@ wheel==0.42.0
2120pytest == 8.3.3
2221pytest-django == 4.9.0
2322pytest-cov == 5.0.0
24- setuptools
You can’t perform that action at this time.
0 commit comments