File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -714,7 +714,7 @@ def _get_form_data(
714714 form_data [f"ticket-{ opr .id } -INITIAL_FORMS" ] = "1"
715715 form_data [f"ticket-{ opr .id } -MIN_NUM_FORMS" ] = "0"
716716 form_data [f"ticket-{ opr .id } -MAX_NUM_FORMS" ] = "1000"
717- for index , ticket in enumerate (opr .shoptickets .all ()):
717+ for index , ticket in enumerate (opr .shoptickets .order_by ( "-created" ). all ()):
718718 form_data [f"ticket-{ opr .id } -{ index } -uuid" ] = str (ticket .uuid )
719719 if ticket in refund_tickets :
720720 form_data [f"ticket-{ opr .id } -{ index } -refund" ] = "on"
@@ -724,7 +724,7 @@ def _get_form_data(
724724 form_data [f"ticket-group-{ opr .id } -INITIAL_FORMS" ] = "1"
725725 form_data [f"ticket-group-{ opr .id } -MIN_NUM_FORMS" ] = "0"
726726 form_data [f"ticket-group-{ opr .id } -MAX_NUM_FORMS" ] = "1000"
727- for index , ticket_group in enumerate (opr .ticketgroups .all ()):
727+ for index , ticket_group in enumerate (opr .ticketgroups .order_by ( "-created" ). all ()):
728728 form_data [f"ticket-group-{ opr .id } -{ index } -uuid" ] = str (
729729 ticket_group .uuid ,
730730 )
Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ def annotate_ticket_info(self):
246246 return self .annotate (
247247 has_used_tickets = Exists (used_tickets_subquery ),
248248 has_tickets = Exists (tickets ),
249- ).distinct ("uuid" )
249+ ).distinct ("uuid" , "created" )
250250
251251 objects = QuerySet .as_manager ()
252252
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ class Meta:
7171class CreatedUpdatedModel (CleanedModel ):
7272 class Meta :
7373 abstract = True
74+ ordering = ["-created" ]
7475
7576 created = models .DateTimeField (auto_now_add = True )
7677 updated = models .DateTimeField (auto_now = True )
@@ -79,6 +80,7 @@ class Meta:
7980class CreatedUpdatedUUIDModel (CleanedModel ):
8081 class Meta :
8182 abstract = True
83+ ordering = ["-created" ]
8284
8385 uuid = models .UUIDField (primary_key = True , default = uuid .uuid4 , editable = False )
8486 created = models .DateTimeField (auto_now_add = True )
@@ -94,6 +96,7 @@ class CampRelatedModel(CreatedUpdatedModel):
9496
9597 class Meta :
9698 abstract = True
99+ ordering = ["-created" ]
97100
98101 def save (self , ** kwargs ) -> None :
99102 if self .camp .read_only :
You can’t perform that action at this time.
0 commit comments