mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-12-09 21:27:47 +01:00
Compare commits
2 Commits
api-update
...
promotion-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a25afea16d | ||
|
|
56167a21b5 |
@@ -30,12 +30,16 @@ class ActivityViewSet(ReadProtectedModelViewSet):
|
||||
The djangorestframework plugin will get all `Activity` objects, serialize it to JSON with the given serializer,
|
||||
then render it on /api/activity/activity/
|
||||
"""
|
||||
queryset = Activity.objects.order_by('-date_start')
|
||||
queryset = Activity.objects.order_by('id')
|
||||
serializer_class = ActivitySerializer
|
||||
filter_backends = [DjangoFilterBackend, RegexSafeSearchFilter]
|
||||
filterset_fields = ['name', 'description', 'activity_type', 'location', 'creater', 'organizer', 'attendees_club',
|
||||
'date_start', 'date_end', 'valid', 'open', ]
|
||||
search_fields = ['$name', '$description', '$location', '$organizer__name', ]
|
||||
search_fields = ['$name', '$description', '$location', '$creater__last_name', '$creater__first_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):
|
||||
|
||||
@@ -19,6 +19,7 @@ from phonenumber_field.modelfields import PhoneNumberField
|
||||
from permission.models import Role
|
||||
from registration.tokens import email_validation_token
|
||||
from note.models import MembershipTransaction
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
|
||||
|
||||
class Profile(models.Model):
|
||||
@@ -76,6 +77,10 @@ class Profile(models.Model):
|
||||
default=datetime.date.today().year if datetime.date.today().month >= 8 else datetime.date.today().year - 1,
|
||||
verbose_name=_("promotion"),
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user