diff --git a/events/forms.py b/events/forms.py index 0ce9d33..6697b35 100644 --- a/events/forms.py +++ b/events/forms.py @@ -225,7 +225,7 @@ class TeamEventForm(forms.ModelForm): recurrences = recurrence.forms.RecurrenceField(label="Repeat", required=False) class Meta: model = Event - fields = ['name', 'start_time', 'end_time', 'recurrences', 'summary', 'web_url', 'announce_url', 'tags'] + fields = ['name', 'start_time', 'end_time', 'recurrences', 'summary', 'web_url', 'announce_url', 'enable_comments', 'enable_photos', 'enable_presentations'] widgets = { 'place': Lookup(source=Place), 'start_time': DateTimeWidget, @@ -302,7 +302,13 @@ class NewEventDetailsForm(forms.ModelForm): class Meta: model = Event - fields = ['summary', 'recurrences', 'web_url', 'announce_url'] + fields = ['summary', 'recurrences', 'web_url', 'announce_url', 'enable_comments', 'enable_photos', 'enable_presentations'] + + +class EventSettingsForm(forms.ModelForm): + class Meta: + model = Event + fields = ['enable_comments', 'enable_photos', 'enable_presentations'] class DeleteEventForm(forms.Form): diff --git a/events/migrations/0044_add_event_settings.py b/events/migrations/0044_add_event_settings.py new file mode 100644 index 0000000..3c29931 --- /dev/null +++ b/events/migrations/0044_add_event_settings.py @@ -0,0 +1,28 @@ +# Generated by Django 2.0 on 2018-08-25 14:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('events', '0043_remove_premium_restrictions'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='enable_comments', + field=models.BooleanField(default=True, verbose_name='Comments'), + ), + migrations.AddField( + model_name='event', + name='enable_photos', + field=models.BooleanField(default=True, verbose_name='Photos'), + ), + migrations.AddField( + model_name='event', + name='enable_presentations', + field=models.BooleanField(default=False, verbose_name='Presentations'), + ), + ] diff --git a/events/models/events.py b/events/models/events.py index c37c395..234ffa0 100644 --- a/events/models/events.py +++ b/events/models/events.py @@ -93,6 +93,11 @@ class Event(models.Model): sponsors = models.ManyToManyField('Sponsor', related_name='events', blank=True) + enable_comments = models.BooleanField(verbose_name=_('Comments'), default=True) + enable_photos = models.BooleanField(verbose_name=_('Photos'), default=True) + enable_presentations = models.BooleanField(verbose_name=_('Presentations'), default=False) + + @property def is_over(self): return self.end_time <= timezone.now() diff --git a/get_together/templates/get_together/events/show_event.html b/get_together/templates/get_together/events/show_event.html index 7eb3924..616832f 100644 --- a/get_together/templates/get_together/events/show_event.html +++ b/get_together/templates/get_together/events/show_event.html @@ -210,6 +210,7 @@ {% endif %} + {% if event.enable_presentations %}