Changed default display time for posters and permissions on it

This commit is contained in:
Antoine Bartuccio 2018-03-18 22:28:25 +01:00
parent d83bb20547
commit cbd333eb47
Signed by: klmp200
GPG Key ID: E7245548C53F904B
3 changed files with 21 additions and 1 deletions

View File

@ -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),
),
]

View File

@ -212,7 +212,7 @@ class Poster(models.Model):
screens = models.ManyToManyField(Screen, related_name="posters") screens = models.ManyToManyField(Screen, related_name="posters")
date_begin = models.DateTimeField(blank=False, null=False, default=timezone.now) date_begin = models.DateTimeField(blank=False, null=False, default=timezone.now)
date_end = models.DateTimeField(blank=True, null=True) 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) is_moderated = models.BooleanField(_("is moderated"), default=False)
moderator = models.ForeignKey(User, related_name="moderated_posters", verbose_name=_("moderator"), null=True, blank=True) moderator = models.ForeignKey(User, related_name="moderated_posters", verbose_name=_("moderator"), null=True, blank=True)

View File

@ -72,6 +72,7 @@ class PosterForm(forms.ModelForm):
if self.user: if self.user:
if not self.user.is_com_admin: if not self.user.is_com_admin:
self.fields['club'].queryset = Club.objects.filter(id__in=self.user.clubs_with_rights) self.fields['club'].queryset = Club.objects.filter(id__in=self.user.clubs_with_rights)
self.fields['display_time'].widget = forms.HiddenInput()
class ComTabsMixin(TabedViewMixin): class ComTabsMixin(TabedViewMixin):