File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 33The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
44and this project uses the ` YYYY.N ` version format.
55
6+ ## 2025.18 - 2025-07-10
7+
8+ ### Fixed
9+
10+ - Fixed competition creation.
11+
612## 2025.17 - 2025-06-18
713
814### Fixed
Original file line number Diff line number Diff line change @@ -38,8 +38,14 @@ class Meta:
3838 "competition_start" : forms .DateTimeInput (attrs = {"type" : "datetime" }),
3939 }
4040
41+ def __init__ (self , branch , ** kwargs ):
42+ self .branch = branch
43+ super ().__init__ (** kwargs )
44+
4145 def save (self , commit : bool = True ):
42- obj = super ().save (commit = True )
46+ obj = super ()
47+ obj .branch = self .branch
48+ obj .save (commit = True )
4349
4450 current_problems = Problem .objects .filter (competition = obj )
4551 current_count = current_problems .count ()
Original file line number Diff line number Diff line change @@ -35,17 +35,23 @@ def get_object(self, queryset=None):
3535 def get_success_url (self ):
3636 return reverse ("badmin:competition_switch" )
3737
38+ def get_form_kwargs (self ):
39+ kwargs = super ().get_form_kwargs ()
40+ kwargs ["branch" ] = self .request .BRANCH
41+ return kwargs
42+
3843
3944class CompetitionCreateView (BranchAdminAccess , GenericForm , CreateView ):
4045 form_class = CompetitionForm
4146 form_title = "New competition"
4247
43- def form_valid (self , form ):
44- competition : Competition = form .save (commit = False )
45- competition .branch = self .request .BRANCH
46- competition .save ()
48+ def get_success_url (self ):
49+ return reverse ("badmin:competition_switch" )
4750
48- return redirect ("badmin:competition_switch" )
51+ def get_form_kwargs (self ):
52+ kwargs = super ().get_form_kwargs ()
53+ kwargs ["branch" ] = self .request .BRANCH
54+ return kwargs
4955
5056
5157class CompetitionFinalizeView (UnlockedCompetitionMixin , BranchAdminAccess , FormView ):
You can’t perform that action at this time.
0 commit comments