diff --git a/hackathon/forms.py b/hackathon/forms.py index 65557fa5..164ed289 100644 --- a/hackathon/forms.py +++ b/hackathon/forms.py @@ -242,12 +242,16 @@ class EventForm(forms.ModelForm): required=False, widget=forms.URLInput(attrs={'class': 'form-control'}) ) - + webinar_code = forms.CharField( + label="Webinar Join Code", + widget=forms.Textarea(attrs={'rows': 1, 'class': 'form-control'}) + ) class Meta: model = Event fields = [ 'title', 'start', 'end', 'body', - 'isReadOnly', 'webinar_link' + 'isReadOnly', 'webinar_link', + 'webinar_code', ] def __init__(self, *args, **kwargs): @@ -257,7 +261,8 @@ def save(self, commit=True): event = super(EventForm, self).save(commit=False) # Append f-string to the body field webinar_link = self.cleaned_data.get('webinar_link', '') - event.body += f'

Meeting Join Link: Click here to join
Meeting Join Code: code' + webinar_code = self.cleaned_data.get('webinar_code', '') + event.body += f'

Meeting Join Link: Click here to join
Meeting Join Code: {webinar_code}' if commit: event.save() return event \ No newline at end of file diff --git a/hackathon/migrations/0064_event_webinar_code.py b/hackathon/migrations/0064_event_webinar_code.py new file mode 100644 index 00000000..59ba0e4c --- /dev/null +++ b/hackathon/migrations/0064_event_webinar_code.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2024-09-16 10:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0063_auto_20240915_1858'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='webinar_code', + field=models.CharField(blank=True, max_length=100, null=True), + ), + ] diff --git a/hackathon/migrations/0065_auto_20240916_1009.py b/hackathon/migrations/0065_auto_20240916_1009.py new file mode 100644 index 00000000..46a955ac --- /dev/null +++ b/hackathon/migrations/0065_auto_20240916_1009.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.13 on 2024-09-16 10:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0064_event_webinar_code'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='webinar_code', + field=models.CharField(blank=True, max_length=50, null=True), + ), + ] diff --git a/hackathon/models.py b/hackathon/models.py index f8f8ecdb..944d757d 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -310,6 +310,7 @@ class Event(models.Model): body = models.TextField(max_length=500, default="") isReadOnly = models.BooleanField(default=True) webinar_link = models.URLField(blank=True, null=True) + webinar_code = models.CharField(max_length=50, blank=True, null=True) def save(self, *args, **kwargs): """ diff --git a/hackathon/templates/hackathon/change_event.html b/hackathon/templates/hackathon/change_event.html index 9fd9b1c6..17c44a8b 100644 --- a/hackathon/templates/hackathon/change_event.html +++ b/hackathon/templates/hackathon/change_event.html @@ -40,6 +40,9 @@

Create Event

{{ form.webinar_link|as_crispy_field }}
+
+ {{ form.webinar_code|as_crispy_field }} +