Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add registration end to events #1264

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions events/migrations/0032_add_registration_end.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.24 on 2024-09-10 10:52

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("events", "0031_add_program_file_question_foreign_key"),
]

operations = [
migrations.AddField(
model_name="event",
name="registration_end_date",
field=models.DateTimeField(null=True),
),
]
18 changes: 18 additions & 0 deletions events/migrations/0033_change_registration_end.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.24 on 2024-09-10 10:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("events", "0032_add_registration_end"),
]

operations = [
migrations.AlterField(
model_name="event",
name="registration_end_date",
field=models.DateTimeField(blank=True, null=True),
),
]
17 changes: 17 additions & 0 deletions events/migrations/0034_remove_requires_invitation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.24 on 2024-09-10 11:34

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("events", "0033_change_registration_end"),
]

operations = [
migrations.RemoveField(
model_name="event",
name="requires_invitation",
),
]
6 changes: 1 addition & 5 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Event(models.Model):
description = models.TextField(blank=True, null=True)
date_start = models.DateTimeField()
date_end = models.DateTimeField()
registration_end_date = models.DateTimeField(blank=True, null=True)
location = models.CharField(max_length=75, blank=True, null=True)
food = models.CharField(max_length=75, blank=True, null=True)
signup_cr = models.BooleanField(
Expand Down Expand Up @@ -57,11 +58,6 @@ class Event(models.Model):
published = models.BooleanField(
blank=False, null=False, verbose_name="The event is published on the website"
)
requires_invitation = models.BooleanField(
blank=False,
null=False,
verbose_name="Participants need an invitation to sign up",
)
contact_person = models.ForeignKey(
User, blank=True, null=True, on_delete=models.CASCADE
)
Expand Down
9 changes: 7 additions & 2 deletions events/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def event(event, request):
"event_start": int(event.date_start.strftime("%s")),
"event_end": int(event.date_end.strftime("%s")),
"event_start_string": event.date_start.strftime("%Y-%m-%d %H:%M"),
"registration_end": int(event.date_start.strftime("%s")),
"registration_end": (
int(event.registration_end_date.strftime("%s"))
if event.registration_end_date
else None
),
"image_url": (
request.build_absolute_uri(event.picture.url) if event.picture else None
),
Expand All @@ -31,7 +35,8 @@ def event(event, request):
"signup_link": signup_url,
"can_create_teams": event.teams_create_s,
"can_join_teams": event.teams_participate_s,
"open_for_signup": event.open_for_signup and event.signup_s,
"open_for_signup_student": event.open_for_signup and event.signup_s,
"open_for_signup_company": event.open_for_signup and event.signup_cr,
}

return data
Expand Down
1 change: 0 additions & 1 deletion events/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def setUp(self):
teams_participate_cr=False,
teams_participate_s=True,
published=False,
requires_invitation=False,
)

def test_animals_can_speak(self):
Expand Down
Loading