Skip to content

Commit cf392a9

Browse files
Fix url validation on create hackathon, update variable is_register name
1 parent dd6d0c3 commit cf392a9

5 files changed

Lines changed: 30 additions & 7 deletions

File tree

hackathon/forms.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ class HackathonForm(forms.ModelForm):
8888
})
8989
)
9090
is_public = forms.BooleanField(required=False)
91-
is_register = forms.BooleanField(required=False, label="Allow external registrations")
91+
allow_external_registrations = forms.BooleanField(required=False, label="Allow external registrations")
9292
registration_form = forms.URLField(
9393
label="External Registration Form",
9494
required=False,
9595
widget=forms.TextInput(
9696
attrs={
97-
'placeholder': 'Add form url if the event is open to external participants'
97+
'placeholder': 'Add form url if the event is open to external participants',
98+
'type':'url',
9899
}
99100
)
100101
)
@@ -109,7 +110,7 @@ class Meta:
109110
fields = ['display_name', 'description', 'theme', 'start_date',
110111
'end_date', 'status', 'organisation', 'score_categories',
111112
'team_size', 'tag_line', 'is_public', 'max_participants',
112-
'is_register', 'registration_form'
113+
'allow_external_registrations', 'registration_form'
113114
]
114115

115116
def __init__(self, *args, **kwargs):
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 3.1.13 on 2024-09-12 15:27
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('hackathon', '0052_auto_20240912_1324'),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name='hackathon',
15+
name='is_register',
16+
),
17+
migrations.AddField(
18+
model_name='hackathon',
19+
name='allow_external_registrations',
20+
field=models.BooleanField(default=False),
21+
),
22+
]

hackathon/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Hackathon(models.Model):
8080
)
8181
is_public = models.BooleanField(default=True)
8282
max_participants = models.IntegerField(default=None, null=True, blank=True)
83-
is_register = models.BooleanField(default=True)
83+
allow_external_registrations = models.BooleanField(default=False)
8484
registration_form = models.URLField(
8585
default="",
8686
blank=True,

hackathon/templates/hackathon/create-event.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ <h1>Create Hackathon</h1>
5959
{{ form.is_public|as_crispy_field }}
6060
</div>
6161
<div class="col-12 col-md-6 mb-3">
62-
{{ form.is_register|as_crispy_field }}
62+
{{ form.allow_external_registrations|as_crispy_field }}
6363
</div>
6464
<div class="col-6 col-md-6 mb-3" id="google-registration-form-wrapper" style="display: none;" >
6565
{{ form.registration_form|as_crispy_field }}
@@ -85,7 +85,7 @@ <h1>Create Hackathon</h1>
8585
<script src="{% static 'js/datetimepicker.js' %}"></script>
8686
<script>
8787
document.addEventListener('DOMContentLoaded', function() {
88-
const isRegisterCheckbox = document.querySelector('#id_is_register');
88+
const isRegisterCheckbox = document.querySelector('#id_allow_external_registrations');
8989
const googleRegistrationFormWrapper = document.querySelector('#google-registration-form-wrapper');
9090

9191
function toggleGoogleRegistrationForm() {

hackathon/templates/hackathon/hackathon_view_public.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<div class="row">
2525
<div class="col p-0">
26-
{% if hackathon.is_register %}
26+
{% if hackathon.allow_external_registrations %}
2727
<a role="button" class="btn btn-ci mt-3 w-100" href="{{ hackathon.registration_form }}" target="_blank">Register your interest</a>
2828
{% else %}
2929
<a role="button" class="btn btn-ci mt-3 w-100" href="{% url 'account_login' %}">Login To Register</a>

0 commit comments

Comments
 (0)