Skip to content

Commit

Permalink
personal: Move Group class definition before Contact
Browse files Browse the repository at this point in the history
We want to reference Group from Contact in the following commit, so move
the class in the source file.
  • Loading branch information
donald committed Feb 9, 2025
1 parent f43cb59 commit 108adbb
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions mpicms/personal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,34 @@ def __str__(self):
class Meta:
ordering = ["title"]


@register_snippet
class Group(index.Indexed, ClusterableModel):
slug = models.CharField(_("slug"), max_length=254)
name = models.CharField(_("name"), max_length=254, blank=True)
priority = models.PositiveSmallIntegerField(
_("priority"), blank=True, default=0, validators=[MaxValueValidator(99)],
help_text=_("Priority from 0-99 to determine the sorting order."))

panels = [
FieldPanel('name'),
FieldPanel('priority'),
]

search_fields = [
index.SearchField('name', partial_match=True),
index.SearchField('slug'),
]

def __str__(self):
return self.name or self.slug

class Meta: # noqa
verbose_name = 'Group'
verbose_name_plural = 'Groups'
ordering = ['name']


@register_snippet
class Contact(index.Indexed, ClusterableModel):
"""
Expand Down Expand Up @@ -168,33 +196,6 @@ class Meta: # noqa
ordering = ['last_name']


@register_snippet
class Group(index.Indexed, ClusterableModel):
slug = models.CharField(_("slug"), max_length=254)
name = models.CharField(_("name"), max_length=254, blank=True)
priority = models.PositiveSmallIntegerField(
_("priority"), blank=True, default=0, validators=[MaxValueValidator(99)],
help_text=_("Priority from 0-99 to determine the sorting order."))

panels = [
FieldPanel('name'),
FieldPanel('priority'),
]

search_fields = [
index.SearchField('name', partial_match=True),
index.SearchField('slug'),
]

def __str__(self):
return self.name or self.slug

class Meta: # noqa
verbose_name = 'Group'
verbose_name_plural = 'Groups'
ordering = ['name']


class WrittenConsent(models.Model):
ref = models.CharField("ID", max_length=10, unique=True)
comment = models.TextField("comment", blank=True)
Expand Down

0 comments on commit 108adbb

Please sign in to comment.