From cd84f478095bbcf4209e7f54b89f41c38e3a67c3 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Tue, 10 Sep 2024 20:54:52 +0000 Subject: [PATCH 01/13] Add bool to event model to check if participants can register --- hackathon/forms.py | 1 + hackathon/models.py | 2 ++ hackathon/templates/hackathon/create-event.html | 3 +++ 3 files changed, 6 insertions(+) diff --git a/hackathon/forms.py b/hackathon/forms.py index 0108ad90..71c25027 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -88,6 +88,7 @@ class HackathonForm(forms.ModelForm): }) ) is_public = forms.BooleanField(required=False) + is_register = forms.BooleanField(required=False, label="Users can register for this event", initial=True) max_participants = forms.IntegerField( label="Max Number Of Participants (leave empty for no max)", required=False, diff --git a/hackathon/models.py b/hackathon/models.py index 6e190dd7..ef08c0b2 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -80,6 +80,8 @@ class Hackathon(models.Model): ) is_public = models.BooleanField(default=True) max_participants = models.IntegerField(default=None, null=True, blank=True) + is_register = models.BooleanField(default=True) + max_participants = models.IntegerField(default=None, null=True, blank=True) 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..732f6121 100644 --- a/hackathon/templates/hackathon/create-event.html +++ b/hackathon/templates/hackathon/create-event.html @@ -58,6 +58,9 @@

Create Hackathon

{{ form.is_public|as_crispy_field }}
+
+ {{ form.is_register|as_crispy_field }} +
{{ form.max_participants|as_crispy_field }}
From 08ce46e6fa420232ec12958059d70e3179a5e82f Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 08:59:18 +0000 Subject: [PATCH 02/13] Fixed is_register in forms --- hackathon/forms.py | 3 ++- .../migrations/0049_hackathon_is_register.py | 18 ++++++++++++++++++ .../templates/hackathon/hackathon_view.html | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 hackathon/migrations/0049_hackathon_is_register.py diff --git a/hackathon/forms.py b/hackathon/forms.py index 71c25027..8668be51 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -88,7 +88,7 @@ class HackathonForm(forms.ModelForm): }) ) is_public = forms.BooleanField(required=False) - is_register = forms.BooleanField(required=False, label="Users can register for this event", initial=True) + is_register = forms.BooleanField(required=False, label="Users can register for this event") max_participants = forms.IntegerField( label="Max Number Of Participants (leave empty for no max)", required=False, @@ -100,6 +100,7 @@ class Meta: fields = ['display_name', 'description', 'theme', 'start_date', 'end_date', 'status', 'organisation', 'score_categories', 'team_size', 'tag_line', 'is_public', 'max_participants', + 'is_register' ] 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/templates/hackathon/hackathon_view.html b/hackathon/templates/hackathon/hackathon_view.html index c7f8e76e..abe315e1 100644 --- a/hackathon/templates/hackathon/hackathon_view.html +++ b/hackathon/templates/hackathon/hackathon_view.html @@ -97,6 +97,7 @@

Theme: {{ hackathon.theme }}

{% if request.user.user_type|is_types:authorised_types %}

Status: {{ hackathon.status }}

+

Is Register: {{ hackathon.is_register }}

Organiser: {{ hackathon.organiser }}

Participants: {{ hackathon.participants.all|length }} / Teams: {{ hackathon.teams.all|length }}

From 8f49e1a32c1466d096203e0e3137f7d0fa37416c Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 10:05:11 +0000 Subject: [PATCH 03/13] Removed enroll button for extenal hackathons and link to google form to register interest --- hackathon/templates/hackathon/includes/enrollpart.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hackathon/templates/hackathon/includes/enrollpart.html b/hackathon/templates/hackathon/includes/enrollpart.html index 0f4e63d6..b8d79130 100644 --- a/hackathon/templates/hackathon/includes/enrollpart.html +++ b/hackathon/templates/hackathon/includes/enrollpart.html @@ -1,6 +1,8 @@ {% load custom_tags %} - -{% if hackathon.status == 'registration_open' and not hackathon.max_participants_reached %} +{% if not hackathon.is_register %} + + Click here to register your interest +{% elif hackathon.status == 'registration_open' and not hackathon.max_participants_reached %}
{% csrf_token %} From 6c3a64569e6d6752825ddc3ed2ef7ceced7a19d9 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 10:14:50 +0000 Subject: [PATCH 04/13] Add logic to hackathon_view_public to direct external hacakthon signups to googleform --- hackathon/templates/hackathon/hackathon_view_public.html | 6 +++++- hackathon/templates/hackathon/includes/enrollpart.html | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hackathon/templates/hackathon/hackathon_view_public.html b/hackathon/templates/hackathon/hackathon_view_public.html index fe03af99..15b0cae0 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 not hackathon.is_register %} + 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 b8d79130..48af9ad5 100644 --- a/hackathon/templates/hackathon/includes/enrollpart.html +++ b/hackathon/templates/hackathon/includes/enrollpart.html @@ -1,8 +1,5 @@ {% load custom_tags %} -{% if not hackathon.is_register %} - - Click here to register your interest -{% elif hackathon.status == 'registration_open' and not hackathon.max_participants_reached %} +{% if hackathon.status == 'registration_open' and not hackathon.max_participants_reached %} {% csrf_token %} From 6a2557b5a08ad0976a2001ea83ec2b407bba008e Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 10:16:07 +0000 Subject: [PATCH 05/13] Fix google form link to open in new window --- hackathon/templates/hackathon/hackathon_view_public.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon/templates/hackathon/hackathon_view_public.html b/hackathon/templates/hackathon/hackathon_view_public.html index 15b0cae0..5c5c85ec 100644 --- a/hackathon/templates/hackathon/hackathon_view_public.html +++ b/hackathon/templates/hackathon/hackathon_view_public.html @@ -24,7 +24,7 @@
{% if not hackathon.is_register %} - Register your interest + Register your interest {% else %} Login To Register {% endif %} From 5241d587a169e4b4c33e8f133a866f1332287935 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 10:26:24 +0000 Subject: [PATCH 06/13] Remove is_register reference from hackathon view --- hackathon/templates/hackathon/hackathon_view.html | 1 - 1 file changed, 1 deletion(-) diff --git a/hackathon/templates/hackathon/hackathon_view.html b/hackathon/templates/hackathon/hackathon_view.html index abe315e1..c7f8e76e 100644 --- a/hackathon/templates/hackathon/hackathon_view.html +++ b/hackathon/templates/hackathon/hackathon_view.html @@ -97,7 +97,6 @@

Theme: {{ hackathon.theme }}

{% if request.user.user_type|is_types:authorised_types %}

Status: {{ hackathon.status }}

-

Is Register: {{ hackathon.is_register }}

Organiser: {{ hackathon.organiser }}

Participants: {{ hackathon.participants.all|length }} / Teams: {{ hackathon.teams.all|length }}

From 97866df70e3a09f0b606cfdee55050c7bd819631 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 11:47:08 +0000 Subject: [PATCH 07/13] Remove duplicate line in models.py --- .env_sample | 22 ---------------------- hackathon/models.py | 1 - 2 files changed, 23 deletions(-) delete mode 100644 .env_sample diff --git a/.env_sample b/.env_sample deleted file mode 100644 index 0f0417d2..00000000 --- a/.env_sample +++ /dev/null @@ -1,22 +0,0 @@ -DEVELOPMENT=1 -SECRET_KEY="your_secret_key_here" -SITE_NAME="localhost" -SLACK_ENABLED=True -SLACK_BOT_TOKEN="your_slack_bot_token_here" -SLACK_WORKSPACE="example-workspace" -SUPPORT_EMAIL = 'support@example.com' - -# dev only -DBHOST=127.0.0.1 -DBPORT=3306 -DBNAME=hackathons -DBUSER=hackthon_user -DBPASS=gummyball - -# http for dev -ACCOUNT_DEFAULT_HTTP_PROTOCOL=http - -# to be used with Mailhog -EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend' -EMAIL_PORT=1025 -EMAIL_HOST=smtp diff --git a/hackathon/models.py b/hackathon/models.py index ef08c0b2..2986b5c9 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -81,7 +81,6 @@ class Hackathon(models.Model): is_public = models.BooleanField(default=True) max_participants = models.IntegerField(default=None, null=True, blank=True) is_register = models.BooleanField(default=True) - max_participants = models.IntegerField(default=None, null=True, blank=True) def __str__(self): return self.display_name From 92b2add7e405ac565f4497fbf714343a4fae8a04 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 12:21:32 +0000 Subject: [PATCH 08/13] Add url field when creating the hackathon for a registration form --- hackathon/forms.py | 15 ++++++++--- ...050_hackathon_google_registrations_form.py | 18 +++++++++++++ hackathon/models.py | 5 ++++ .../templates/hackathon/create-event.html | 26 +++++++++++++++++-- 4 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 hackathon/migrations/0050_hackathon_google_registrations_form.py diff --git a/hackathon/forms.py b/hackathon/forms.py index 8668be51..579f9ccd 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -88,11 +88,20 @@ class HackathonForm(forms.ModelForm): }) ) is_public = forms.BooleanField(required=False) - is_register = forms.BooleanField(required=False, label="Users can register for this event") + is_register = forms.BooleanField(required=False, label="Allow external registrations") + google_registration_form = forms.URLField( + label="Registration Form url", + required=False, + widget=forms.TextInput( + attrs={ + 'placeholder': 'Add form url if the event is open to external participants' + } + ) + ) 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: 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/models.py b/hackathon/models.py index 2986b5c9..a027db8c 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -81,6 +81,11 @@ class Hackathon(models.Model): is_public = models.BooleanField(default=True) max_participants = models.IntegerField(default=None, null=True, blank=True) is_register = models.BooleanField(default=True) + google_registrations_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 732f6121..a9b82390 100644 --- a/hackathon/templates/hackathon/create-event.html +++ b/hackathon/templates/hackathon/create-event.html @@ -55,13 +55,16 @@

Create Hackathon

{{ form.score_categories|as_crispy_field }}
-
+
{{ form.is_public|as_crispy_field }}
{{ form.is_register|as_crispy_field }}
-
+ +
{{ form.max_participants|as_crispy_field }}
@@ -80,4 +83,23 @@

Create Hackathon

integrity="sha256-FEqEelWI3WouFOo2VWP/uJfs1y8KJ++FLh2Lbqc8SJk=" crossorigin="anonymous"> + {% endblock %} From 9761aeecc4e287dc66578c9ba24d769cc8a7b992 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 13:43:39 +0000 Subject: [PATCH 09/13] Fix google form url variable not saving to model on edit --- hackathon/forms.py | 4 ++-- .../migrations/0051_auto_20240911_1306.py | 18 ++++++++++++++++++ hackathon/models.py | 2 +- .../templates/hackathon/create-event.html | 4 ++-- .../hackathon/hackathon_view_public.html | 2 +- scripts/docker_seed.sh | 18 +++++++++--------- 6 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 hackathon/migrations/0051_auto_20240911_1306.py diff --git a/hackathon/forms.py b/hackathon/forms.py index 579f9ccd..c5a5e425 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -90,7 +90,7 @@ class HackathonForm(forms.ModelForm): is_public = forms.BooleanField(required=False) is_register = forms.BooleanField(required=False, label="Allow external registrations") google_registration_form = forms.URLField( - label="Registration Form url", + label="External Registration Form", required=False, widget=forms.TextInput( attrs={ @@ -109,7 +109,7 @@ class Meta: fields = ['display_name', 'description', 'theme', 'start_date', 'end_date', 'status', 'organisation', 'score_categories', 'team_size', 'tag_line', 'is_public', 'max_participants', - 'is_register' + 'is_register', 'google_registration_form' ] def __init__(self, *args, **kwargs): 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/models.py b/hackathon/models.py index a027db8c..e62471ea 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -81,7 +81,7 @@ class Hackathon(models.Model): is_public = models.BooleanField(default=True) max_participants = models.IntegerField(default=None, null=True, blank=True) is_register = models.BooleanField(default=True) - google_registrations_form = models.URLField( + google_registration_form = models.URLField( default="", blank=True, help_text=("Link to the Google Form for registrations.") diff --git a/hackathon/templates/hackathon/create-event.html b/hackathon/templates/hackathon/create-event.html index a9b82390..df19c44a 100644 --- a/hackathon/templates/hackathon/create-event.html +++ b/hackathon/templates/hackathon/create-event.html @@ -55,7 +55,7 @@

Create Hackathon

{{ form.score_categories|as_crispy_field }}
-
+
{{ form.is_public|as_crispy_field }}
@@ -68,7 +68,7 @@

Create Hackathon

{{ form.max_participants|as_crispy_field }}
- + Cancel
diff --git a/hackathon/templates/hackathon/hackathon_view_public.html b/hackathon/templates/hackathon/hackathon_view_public.html index 5c5c85ec..906c7f81 100644 --- a/hackathon/templates/hackathon/hackathon_view_public.html +++ b/hackathon/templates/hackathon/hackathon_view_public.html @@ -24,7 +24,7 @@
{% if not hackathon.is_register %} - Register your interest + Register your interest {% else %} Login To Register {% endif %} 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 From c304a9c0b9e64cd156321207ecfcbc0ad6da4418 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Wed, 11 Sep 2024 13:48:52 +0000 Subject: [PATCH 10/13] Fix logic on hackathon public view --- hackathon/templates/hackathon/hackathon_view_public.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon/templates/hackathon/hackathon_view_public.html b/hackathon/templates/hackathon/hackathon_view_public.html index 906c7f81..11e8dda9 100644 --- a/hackathon/templates/hackathon/hackathon_view_public.html +++ b/hackathon/templates/hackathon/hackathon_view_public.html @@ -23,7 +23,7 @@
- {% if not hackathon.is_register %} + {% if hackathon.is_register %} Register your interest {% else %} Login To Register From de7aca02efeeb842bbd6770d3dadb80980d0fbab Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Thu, 12 Sep 2024 13:23:17 +0000 Subject: [PATCH 11/13] Add .env_sample --- .env_sample | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .env_sample diff --git a/.env_sample b/.env_sample new file mode 100644 index 00000000..0f0417d2 --- /dev/null +++ b/.env_sample @@ -0,0 +1,22 @@ +DEVELOPMENT=1 +SECRET_KEY="your_secret_key_here" +SITE_NAME="localhost" +SLACK_ENABLED=True +SLACK_BOT_TOKEN="your_slack_bot_token_here" +SLACK_WORKSPACE="example-workspace" +SUPPORT_EMAIL = 'support@example.com' + +# dev only +DBHOST=127.0.0.1 +DBPORT=3306 +DBNAME=hackathons +DBUSER=hackthon_user +DBPASS=gummyball + +# http for dev +ACCOUNT_DEFAULT_HTTP_PROTOCOL=http + +# to be used with Mailhog +EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend' +EMAIL_PORT=1025 +EMAIL_HOST=smtp From dd6d0c3dac37bbeef892fcc879d99c04ae1e9702 Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Thu, 12 Sep 2024 13:30:02 +0000 Subject: [PATCH 12/13] Update google_registration_form variable to registration_form in view, forms, model, templates --- hackathon/forms.py | 4 ++-- .../migrations/0052_auto_20240912_1324.py | 18 ++++++++++++++++++ hackathon/models.py | 2 +- .../templates/hackathon/create-event.html | 2 +- .../hackathon/hackathon_view_public.html | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 hackathon/migrations/0052_auto_20240912_1324.py diff --git a/hackathon/forms.py b/hackathon/forms.py index c5a5e425..2876768a 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -89,7 +89,7 @@ class HackathonForm(forms.ModelForm): ) is_public = forms.BooleanField(required=False) is_register = forms.BooleanField(required=False, label="Allow external registrations") - google_registration_form = forms.URLField( + registration_form = forms.URLField( label="External Registration Form", required=False, widget=forms.TextInput( @@ -109,7 +109,7 @@ class Meta: fields = ['display_name', 'description', 'theme', 'start_date', 'end_date', 'status', 'organisation', 'score_categories', 'team_size', 'tag_line', 'is_public', 'max_participants', - 'is_register', 'google_registration_form' + 'is_register', 'registration_form' ] def __init__(self, *args, **kwargs): 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/models.py b/hackathon/models.py index e62471ea..6802d93a 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -81,7 +81,7 @@ class Hackathon(models.Model): is_public = models.BooleanField(default=True) max_participants = models.IntegerField(default=None, null=True, blank=True) is_register = models.BooleanField(default=True) - google_registration_form = models.URLField( + registration_form = models.URLField( default="", blank=True, help_text=("Link to the Google Form for registrations.") diff --git a/hackathon/templates/hackathon/create-event.html b/hackathon/templates/hackathon/create-event.html index df19c44a..e1a0ec55 100644 --- a/hackathon/templates/hackathon/create-event.html +++ b/hackathon/templates/hackathon/create-event.html @@ -62,7 +62,7 @@

Create Hackathon

{{ form.is_register|as_crispy_field }}
{{ form.max_participants|as_crispy_field }} diff --git a/hackathon/templates/hackathon/hackathon_view_public.html b/hackathon/templates/hackathon/hackathon_view_public.html index 11e8dda9..aa591721 100644 --- a/hackathon/templates/hackathon/hackathon_view_public.html +++ b/hackathon/templates/hackathon/hackathon_view_public.html @@ -24,7 +24,7 @@
{% if hackathon.is_register %} - Register your interest + Register your interest {% else %} Login To Register {% endif %} From cf392a9e3a0aa521b3ea431e56bb74ff398cdcea Mon Sep 17 00:00:00 2001 From: Kenan Wright Date: Thu, 12 Sep 2024 15:35:01 +0000 Subject: [PATCH 13/13] Fix url validation on create hackathon, update variable is_register name --- hackathon/forms.py | 7 +++--- .../migrations/0053_auto_20240912_1527.py | 22 +++++++++++++++++++ hackathon/models.py | 2 +- .../templates/hackathon/create-event.html | 4 ++-- .../hackathon/hackathon_view_public.html | 2 +- 5 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 hackathon/migrations/0053_auto_20240912_1527.py diff --git a/hackathon/forms.py b/hackathon/forms.py index 2876768a..96c54b43 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -88,13 +88,14 @@ class HackathonForm(forms.ModelForm): }) ) is_public = forms.BooleanField(required=False) - is_register = forms.BooleanField(required=False, label="Allow external registrations") + 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' + 'placeholder': 'Add form url if the event is open to external participants', + 'type':'url', } ) ) @@ -109,7 +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', - 'is_register', 'registration_form' + 'allow_external_registrations', 'registration_form' ] def __init__(self, *args, **kwargs): 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 6802d93a..66207b36 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -80,7 +80,7 @@ class Hackathon(models.Model): ) is_public = models.BooleanField(default=True) max_participants = models.IntegerField(default=None, null=True, blank=True) - is_register = models.BooleanField(default=True) + allow_external_registrations = models.BooleanField(default=False) registration_form = models.URLField( default="", blank=True, diff --git a/hackathon/templates/hackathon/create-event.html b/hackathon/templates/hackathon/create-event.html index e1a0ec55..f7196daf 100644 --- a/hackathon/templates/hackathon/create-event.html +++ b/hackathon/templates/hackathon/create-event.html @@ -59,7 +59,7 @@

Create Hackathon

{{ form.is_public|as_crispy_field }}
- {{ form.is_register|as_crispy_field }} + {{ form.allow_external_registrations|as_crispy_field }}