Skip to content

Commit

Permalink
Set ordering and unique_together on events
Browse files Browse the repository at this point in the history
  • Loading branch information
blopker committed Aug 11, 2024
1 parent 07fe6e3 commit 041837f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 5.0.8 on 2024-08-11 00:43

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('circles', '0038_alter_circlecategory_options_alter_circle_image_and_more'),
]

operations = [
migrations.AlterModelOptions(
name='circleevent',
options={'ordering': ['start']},
),
migrations.AlterUniqueTogether(
name='circleevent',
unique_together={('circle', 'start', 'open')},
),
]
4 changes: 4 additions & 0 deletions totem/circles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ class CircleEvent(AdminURLMixin, MarkdownMixin, SluggedModel):
seats = models.IntegerField(default=8)
start = models.DateTimeField(default=timezone.now)

class Meta:
ordering = ["start"]
unique_together = [["circle", "start", "open"]]

def get_absolute_url(self) -> str:
return reverse("circles:event_detail", kwargs={"event_slug": self.slug})

Expand Down

0 comments on commit 041837f

Please sign in to comment.