mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-12-11 14:07:52 +01:00
Compare commits
2 Commits
promotion-
...
api-update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0a2cb1d62 | ||
|
|
412ea7b609 |
@@ -30,16 +30,12 @@ class ActivityViewSet(ReadProtectedModelViewSet):
|
|||||||
The djangorestframework plugin will get all `Activity` objects, serialize it to JSON with the given serializer,
|
The djangorestframework plugin will get all `Activity` objects, serialize it to JSON with the given serializer,
|
||||||
then render it on /api/activity/activity/
|
then render it on /api/activity/activity/
|
||||||
"""
|
"""
|
||||||
queryset = Activity.objects.order_by('id')
|
queryset = Activity.objects.order_by('-date_start')
|
||||||
serializer_class = ActivitySerializer
|
serializer_class = ActivitySerializer
|
||||||
filter_backends = [DjangoFilterBackend, RegexSafeSearchFilter]
|
filter_backends = [DjangoFilterBackend, RegexSafeSearchFilter]
|
||||||
filterset_fields = ['name', 'description', 'activity_type', 'location', 'creater', 'organizer', 'attendees_club',
|
filterset_fields = ['name', 'description', 'activity_type', 'location', 'creater', 'organizer', 'attendees_club',
|
||||||
'date_start', 'date_end', 'valid', 'open', ]
|
'date_start', 'date_end', 'valid', 'open', ]
|
||||||
search_fields = ['$name', '$description', '$location', '$creater__last_name', '$creater__first_name',
|
search_fields = ['$name', '$description', '$location', '$organizer__name', ]
|
||||||
'$creater__email', '$creater__note__alias__name', '$creater__note__alias__normalized_name',
|
|
||||||
'$organizer__name', '$organizer__email', '$organizer__note__alias__name',
|
|
||||||
'$organizer__note__alias__normalized_name', '$attendees_club__name', '$attendees_club__email',
|
|
||||||
'$attendees_club__note__alias__name', '$attendees_club__note__alias__normalized_name', ]
|
|
||||||
|
|
||||||
|
|
||||||
class GuestViewSet(ReadProtectedModelViewSet):
|
class GuestViewSet(ReadProtectedModelViewSet):
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from phonenumber_field.modelfields import PhoneNumberField
|
|||||||
from permission.models import Role
|
from permission.models import Role
|
||||||
from registration.tokens import email_validation_token
|
from registration.tokens import email_validation_token
|
||||||
from note.models import MembershipTransaction
|
from note.models import MembershipTransaction
|
||||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
|
||||||
|
|
||||||
|
|
||||||
class Profile(models.Model):
|
class Profile(models.Model):
|
||||||
@@ -77,10 +76,6 @@ class Profile(models.Model):
|
|||||||
default=datetime.date.today().year if datetime.date.today().month >= 8 else datetime.date.today().year - 1,
|
default=datetime.date.today().year if datetime.date.today().month >= 8 else datetime.date.today().year - 1,
|
||||||
verbose_name=_("promotion"),
|
verbose_name=_("promotion"),
|
||||||
help_text=_("Year of entry to the school (None if not ENS student)"),
|
help_text=_("Year of entry to the school (None if not ENS student)"),
|
||||||
validators=[
|
|
||||||
MinValueValidator(1912),
|
|
||||||
MaxValueValidator(datetime.date.today().year if datetime.date.today().month >= 8 else datetime.date.today().year - 1)
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
address = models.CharField(
|
address = models.CharField(
|
||||||
|
|||||||
Reference in New Issue
Block a user