From cbd333eb47d97eae69a03f4e24267e2a25c45ec7 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Sun, 18 Mar 2018 22:28:25 +0100 Subject: [PATCH] Changed default display time for posters and permissions on it --- com/migrations/0005_auto_20180318_2227.py | 19 +++++++++++++++++++ com/models.py | 2 +- com/views.py | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 com/migrations/0005_auto_20180318_2227.py diff --git a/com/migrations/0005_auto_20180318_2227.py b/com/migrations/0005_auto_20180318_2227.py new file mode 100644 index 00000000..3b0cb351 --- /dev/null +++ b/com/migrations/0005_auto_20180318_2227.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('com', '0004_auto_20171221_1614'), + ] + + operations = [ + migrations.AlterField( + model_name='poster', + name='display_time', + field=models.IntegerField(verbose_name='display time', default=15), + ), + ] diff --git a/com/models.py b/com/models.py index b74e7904..47ae771d 100644 --- a/com/models.py +++ b/com/models.py @@ -212,7 +212,7 @@ class Poster(models.Model): screens = models.ManyToManyField(Screen, related_name="posters") date_begin = models.DateTimeField(blank=False, null=False, default=timezone.now) date_end = models.DateTimeField(blank=True, null=True) - display_time = models.IntegerField(_("display time"), blank=False, null=False, default=30) + display_time = models.IntegerField(_("display time"), blank=False, null=False, default=15) is_moderated = models.BooleanField(_("is moderated"), default=False) moderator = models.ForeignKey(User, related_name="moderated_posters", verbose_name=_("moderator"), null=True, blank=True) diff --git a/com/views.py b/com/views.py index a8d906cc..072ca8ae 100644 --- a/com/views.py +++ b/com/views.py @@ -72,6 +72,7 @@ class PosterForm(forms.ModelForm): if self.user: if not self.user.is_com_admin: self.fields['club'].queryset = Club.objects.filter(id__in=self.user.clubs_with_rights) + self.fields['display_time'].widget = forms.HiddenInput() class ComTabsMixin(TabedViewMixin):