diff --git a/hackathon/forms.py b/hackathon/forms.py index 0108ad90..96c54b43 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -88,10 +88,21 @@ class HackathonForm(forms.ModelForm): }) ) is_public = forms.BooleanField(required=False) + allow_external_registrations = forms.BooleanField(required=False, label="Allow external registrations") + registration_form = forms.URLField( + label="External Registration Form", + required=False, + widget=forms.TextInput( + attrs={ + 'placeholder': 'Add form url if the event is open to external participants', + 'type':'url', + } + ) + ) max_participants = forms.IntegerField( - label="Max Number Of Participants (leave empty for no max)", + label="Max Participants", required=False, - widget=forms.TextInput({'type': 'number'}) + widget=forms.TextInput({'type': 'number', 'placeholder': 'Leave empty for no max'}) ) class Meta: @@ -99,6 +110,7 @@ class Meta: fields = ['display_name', 'description', 'theme', 'start_date', 'end_date', 'status', 'organisation', 'score_categories', 'team_size', 'tag_line', 'is_public', 'max_participants', + 'allow_external_registrations', 'registration_form' ] def __init__(self, *args, **kwargs): diff --git a/hackathon/migrations/0049_hackathon_is_register.py b/hackathon/migrations/0049_hackathon_is_register.py new file mode 100644 index 00000000..030e2fdb --- /dev/null +++ b/hackathon/migrations/0049_hackathon_is_register.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2024-09-11 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0048_auto_20221219_1655'), + ] + + operations = [ + migrations.AddField( + model_name='hackathon', + name='is_register', + field=models.BooleanField(default=True), + ), + ] diff --git a/hackathon/migrations/0050_hackathon_google_registrations_form.py b/hackathon/migrations/0050_hackathon_google_registrations_form.py new file mode 100644 index 00000000..ce6c7d1a --- /dev/null +++ b/hackathon/migrations/0050_hackathon_google_registrations_form.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2024-09-11 11:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0049_hackathon_is_register'), + ] + + operations = [ + migrations.AddField( + model_name='hackathon', + name='google_registrations_form', + field=models.URLField(blank=True, default='', help_text='Link to the Google Form for registrations.'), + ), + ] diff --git a/hackathon/migrations/0051_auto_20240911_1306.py b/hackathon/migrations/0051_auto_20240911_1306.py new file mode 100644 index 00000000..3387fc24 --- /dev/null +++ b/hackathon/migrations/0051_auto_20240911_1306.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2024-09-11 13:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0050_hackathon_google_registrations_form'), + ] + + operations = [ + migrations.RenameField( + model_name='hackathon', + old_name='google_registrations_form', + new_name='google_registration_form', + ), + ] diff --git a/hackathon/migrations/0052_auto_20240912_1324.py b/hackathon/migrations/0052_auto_20240912_1324.py new file mode 100644 index 00000000..221661a3 --- /dev/null +++ b/hackathon/migrations/0052_auto_20240912_1324.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2024-09-12 13:24 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0051_auto_20240911_1306'), + ] + + operations = [ + migrations.RenameField( + model_name='hackathon', + old_name='google_registration_form', + new_name='registration_form', + ), + ] diff --git a/hackathon/migrations/0053_auto_20240912_1527.py b/hackathon/migrations/0053_auto_20240912_1527.py new file mode 100644 index 00000000..c6b74a02 --- /dev/null +++ b/hackathon/migrations/0053_auto_20240912_1527.py @@ -0,0 +1,22 @@ +# Generated by Django 3.1.13 on 2024-09-12 15:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0052_auto_20240912_1324'), + ] + + operations = [ + migrations.RemoveField( + model_name='hackathon', + name='is_register', + ), + migrations.AddField( + model_name='hackathon', + name='allow_external_registrations', + field=models.BooleanField(default=False), + ), + ] diff --git a/hackathon/models.py b/hackathon/models.py index 6e190dd7..66207b36 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -80,6 +80,12 @@ class Hackathon(models.Model): ) is_public = models.BooleanField(default=True) max_participants = models.IntegerField(default=None, null=True, blank=True) + allow_external_registrations = models.BooleanField(default=False) + registration_form = models.URLField( + default="", + blank=True, + help_text=("Link to the Google Form for registrations.") + ) def __str__(self): return self.display_name diff --git a/hackathon/templates/hackathon/create-event.html b/hackathon/templates/hackathon/create-event.html index 333dea60..f7196daf 100644 --- a/hackathon/templates/hackathon/create-event.html +++ b/hackathon/templates/hackathon/create-event.html @@ -55,14 +55,20 @@

Create Hackathon

{{ form.score_categories|as_crispy_field }}
-
+
{{ form.is_public|as_crispy_field }}
+ {{ form.allow_external_registrations|as_crispy_field }} +
+ +
{{ form.max_participants|as_crispy_field }}
- + Cancel
@@ -77,4 +83,23 @@

Create Hackathon

integrity="sha256-FEqEelWI3WouFOo2VWP/uJfs1y8KJ++FLh2Lbqc8SJk=" crossorigin="anonymous"> + {% endblock %} diff --git a/hackathon/templates/hackathon/hackathon_view_public.html b/hackathon/templates/hackathon/hackathon_view_public.html index fe03af99..1ae66fc2 100644 --- a/hackathon/templates/hackathon/hackathon_view_public.html +++ b/hackathon/templates/hackathon/hackathon_view_public.html @@ -23,7 +23,11 @@
- Login To Register + {% if hackathon.allow_external_registrations %} + Register your interest + {% else %} + Login To Register + {% endif %}
diff --git a/hackathon/templates/hackathon/includes/enrollpart.html b/hackathon/templates/hackathon/includes/enrollpart.html index 0f4e63d6..48af9ad5 100644 --- a/hackathon/templates/hackathon/includes/enrollpart.html +++ b/hackathon/templates/hackathon/includes/enrollpart.html @@ -1,5 +1,4 @@ {% load custom_tags %} - {% if hackathon.status == 'registration_open' and not hackathon.max_participants_reached %}
{% csrf_token %} diff --git a/scripts/docker_seed.sh b/scripts/docker_seed.sh index ed5a96f1..0eff5ea1 100755 --- a/scripts/docker_seed.sh +++ b/scripts/docker_seed.sh @@ -1,12 +1,12 @@ echo "============================" echo "Seeding fixtures" echo "============================" -docker-compose exec hackathon-app python3 manage.py loaddata organisation -docker-compose exec hackathon-app python3 manage.py loaddata accounts -docker-compose exec hackathon-app python3 manage.py loaddata resources -docker-compose exec hackathon-app python3 manage.py loaddata profiles -docker-compose exec hackathon-app python3 manage.py loaddata emailaddresses -docker-compose exec hackathon-app python3 manage.py loaddata hackathons -docker-compose exec hackathon-app python3 manage.py loaddata showcase -docker-compose exec hackathon-app python3 manage.py loaddata showcase_site_settings -docker-compose exec hackathon-app python3 manage.py loaddata reviews +docker compose exec hackathon-app python3 manage.py loaddata organisation +docker compose exec hackathon-app python3 manage.py loaddata accounts +docker compose exec hackathon-app python3 manage.py loaddata resources +docker compose exec hackathon-app python3 manage.py loaddata profiles +docker compose exec hackathon-app python3 manage.py loaddata emailaddresses +docker compose exec hackathon-app python3 manage.py loaddata hackathons +docker compose exec hackathon-app python3 manage.py loaddata showcase +docker compose exec hackathon-app python3 manage.py loaddata showcase_site_settings +docker compose exec hackathon-app python3 manage.py loaddata reviews