Club views and discussions fixes

This commit is contained in:
gnikwo 2017-11-01 18:12:33 +01:00
parent 693c3ed27e
commit 21b24f2891
No known key found for this signature in database
GPG Key ID: 7498D7DF2F867695
14 changed files with 182 additions and 42 deletions

View File

@ -11,6 +11,7 @@
<li> <a href="{{ url('trombi:detail', trombi_id=object.trombi.id) }}">{% trans %}Edit Trombi{% endtrans %}</a></li> <li> <a href="{{ url('trombi:detail', trombi_id=object.trombi.id) }}">{% trans %}Edit Trombi{% endtrans %}</a></li>
{% else %} {% else %}
<li> <a href="{{ url('trombi:create', club_id=object.id) }}">{% trans %}New Trombi{% endtrans %}</a></li> <li> <a href="{{ url('trombi:create', club_id=object.id) }}">{% trans %}New Trombi{% endtrans %}</a></li>
<li> <a href="{{ url('club:poster_list', club_id=object.id) }}">{% trans %}Posters{% endtrans %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
<h4>{% trans %}Counters:{% endtrans %}</h4> <h4>{% trans %}Counters:{% endtrans %}</h4>

View File

@ -50,4 +50,7 @@ urlpatterns = [
url(r'^(?P<mailing_id>[0-9]+)/mailing/delete$', MailingDeleteView.as_view(), name='mailing_delete'), url(r'^(?P<mailing_id>[0-9]+)/mailing/delete$', MailingDeleteView.as_view(), name='mailing_delete'),
url(r'^(?P<mailing_subscription_id>[0-9]+)/mailing/delete/subscription$', MailingSubscriptionDeleteView.as_view(), name='mailing_subscription_delete'), url(r'^(?P<mailing_subscription_id>[0-9]+)/mailing/delete/subscription$', MailingSubscriptionDeleteView.as_view(), name='mailing_subscription_delete'),
url(r'^membership/(?P<membership_id>[0-9]+)/set_old$', MembershipSetOldView.as_view(), name='membership_set_old'), url(r'^membership/(?P<membership_id>[0-9]+)/set_old$', MembershipSetOldView.as_view(), name='membership_set_old'),
url(r'^(?P<club_id>[0-9]+)/poster$', PosterListView.as_view(), name='poster_list'),
url(r'^(?P<club_id>[0-9]+)/poster/create$', PosterCreateView.as_view(), name='poster_create'),
url(r'^(?P<club_id>[0-9]+)/poster/(?P<poster_id>[0-9]+)/edit$', PosterEditView.as_view(), name='poster_edit'),
] ]

View File

@ -37,12 +37,13 @@ from ajax_select.fields import AutoCompleteSelectField
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, PageEditViewBase from core.views import CanCreateMixin, CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, PageEditViewBase
from core.views.forms import SelectDate, SelectDateTime from core.views.forms import SelectDate, SelectDateTime, PosterForm
from club.models import Club, Membership, Mailing, MailingSubscription from club.models import Club, Membership, Mailing, MailingSubscription
from sith.settings import SITH_MAXIMUM_FREE_ROLE from sith.settings import SITH_MAXIMUM_FREE_ROLE
from counter.models import Selling, Counter from counter.models import Selling, Counter
from core.models import User, PageRev from core.models import User, PageRev
from com.models import Poster
from django.conf import settings from django.conf import settings
@ -141,6 +142,11 @@ class ClubTabsMixin(TabedViewMixin):
'slug': 'mailing', 'slug': 'mailing',
'name': _("Mailing list"), 'name': _("Mailing list"),
}) })
tab_list.append({
'url': reverse('club:poster_list', kwargs={'club_id': self.object.id}),
'slug': 'posters',
'name': _("Posters list"),
})
if self.request.user.is_owner(self.object): if self.request.user.is_owner(self.object):
tab_list.append({ tab_list.append({
'url': reverse('club:club_prop', kwargs={'club_id': self.object.id}), 'url': reverse('club:club_prop', kwargs={'club_id': self.object.id}),
@ -592,3 +598,75 @@ class MailingAutoCleanView(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.mailing.subscriptions.all().delete() self.mailing.subscriptions.all().delete()
return redirect('club:mailing', club_id=self.mailing.club.id) return redirect('club:mailing', club_id=self.mailing.club.id)
class PosterListView(CanViewMixin, ListView):
"""List communication posters"""
current_tab = "posters"
model = Poster
template_name = 'core/poster_list.jinja'
def dispatch(self, request, *args, **kwargs):
self.club = get_object_or_404(Club, pk=kwargs['club_id'])
return super(PosterListView, self).dispatch(request, *args, **kwargs)
def get_queryset(self):
return Poster.objects.filter(club=self.club.id)
def get_context_data(self, **kwargs):
kwargs = super(PosterListView, self).get_context_data(**kwargs)
kwargs['club'] = self.club
kwargs['app'] = "club"
kwargs['poster_create_url_name'] = "club:poster_create"
kwargs['poster_edit_url_name'] = "club:poster_edit"
kwargs['poster_list_url_name'] = "club:poster_list"
return kwargs
class PosterCreateView(CanCreateMixin, CreateView):
"""Create communication poster"""
current_tab = "posters"
form_class = PosterForm
template_name = 'core/create.jinja'
success_url = reverse_lazy('club:poster_list')
def dispatch(self, request, *args, **kwargs):
self.club = get_object_or_404(Club, pk=kwargs['club_id'])
self.request = request
return super(PosterCreateView, self).dispatch(request, *args, **kwargs)
def get_initial(self):
initials = super(PosterCreateView, self).get_initial()
initials['user'] = self.request.user
def get_context_data(self, **kwargs):
kwargs = super(PosterCreateView, self).get_context_data(**kwargs)
kwargs['club'] = self.club
kwargs['app'] = "club"
kwargs['poster_create_url_name'] = "club:poster_create"
kwargs['poster_edit_url_name'] = "club:poster_edit"
kwargs['poster_list_url_name'] = "club:poster_list"
return kwargs
class PosterEditView(CanEditMixin, UpdateView):
"""Edit communication poster"""
pk_url_kwarg = "poster_id"
current_tab = "posters"
form_class = PosterForm
template_name = 'core/poster_edit.jinja'
success_url = reverse_lazy('club:poster_list')
def dispatch(self, request, *args, **kwargs):
self.club = get_object_or_404(Club, pk=kwargs['club_id'])
self.request = request
return super(PosterCreateView, self).dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs):
kwargs = super(PosterEditView, self).get_context_data(**kwargs)
kwargs['club'] = self.club
kwargs['app'] = "club"
kwargs['poster_create_url_name'] = "club:poster_create"
kwargs['poster_edit_url_name'] = "club:poster_edit"
kwargs['poster_list_url_name'] = "club:poster_list"
return kwargs

View File

@ -200,7 +200,7 @@ class Screen(models.Model):
return user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) return user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID)
def __str__(self): def __str__(self):
return "%s: %s" % (self.club, self.name) return "%s" % (self.name)
class Poster(models.Model): class Poster(models.Model):
name = models.CharField(_("name"), blank=False, null=False, max_length=128, default="") name = models.CharField(_("name"), blank=False, null=False, max_length=128, default="")
@ -218,7 +218,7 @@ class Poster(models.Model):
return super(Poster, self).save(*args, **kwargs) return super(Poster, self).save(*args, **kwargs)
def is_owned_by(self, user): def is_owned_by(self, user):
return user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) return user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) or Club.objects.filter(id__in=user.get_clubs_with_rights())
def can_be_moderated_by(self, user): def can_be_moderated_by(self, user):
return user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) return user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID)

View File

@ -42,7 +42,7 @@ from datetime import timedelta
from com.models import Sith, News, NewsDate, Weekmail, WeekmailArticle, Screen, Poster from com.models import Sith, News, NewsDate, Weekmail, WeekmailArticle, Screen, Poster
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, CanCreateMixin, QuickNotifMixin from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, CanCreateMixin, QuickNotifMixin
from core.views.forms import SelectDateTime from core.views.forms import SelectDateTime, PosterForm
from core.models import Notification, RealGroup, User from core.models import Notification, RealGroup, User
from club.models import Club, Mailing from club.models import Club, Mailing
@ -104,7 +104,7 @@ class ComTabsMixin(TabedViewMixin):
class IsComAdminMixin(View): class IsComAdminMixin(View):
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
if not (request.user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) or request.user.is_root): if not (request.user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID)):
raise PermissionDenied raise PermissionDenied
return super(IsComAdminMixin, self).dispatch(request, *args, **kwargs) return super(IsComAdminMixin, self).dispatch(request, *args, **kwargs)
@ -135,14 +135,6 @@ class IndexEditView(ComEditView):
success_url = reverse_lazy('com:index_edit') success_url = reverse_lazy('com:index_edit')
class ModerateListView(ListView):
"""Generic view for moderation pages"""
class ModerateView(View):
"""Generic view for moderation pages"""
class WeekmailDestinationEditView(ComEditView): class WeekmailDestinationEditView(ComEditView):
fields = ['weekmail_destinations'] fields = ['weekmail_destinations']
current_tab = "weekmail_destinations" current_tab = "weekmail_destinations"
@ -497,32 +489,52 @@ class PosterListView(IsComAdminMixin, ComTabsMixin, ListView):
"""List communication posters""" """List communication posters"""
current_tab = "posters" current_tab = "posters"
model = Poster model = Poster
template_name = 'com/poster_list.jinja' template_name = 'core/poster_list.jinja'
queryset = Poster.objects.all().order_by('-date_begin')
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterListView, self).get_context_data(**kwargs) kwargs = super(PosterListView, self).get_context_data(**kwargs)
kwargs['posters'] = Poster.objects.all().order_by('-date_begin') kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs return kwargs
class PosterCreateView(IsComAdminMixin, ComTabsMixin, CreateView): class PosterCreateView(IsComAdminMixin, ComTabsMixin, CreateView):
"""Create communication poster""" """Create communication poster"""
current_tab = "posters" current_tab = "posters"
model = Poster form_class = PosterForm
fields = ['name', 'file', 'screens', 'date_begin', 'date_end']
template_name = 'core/create.jinja' template_name = 'core/create.jinja'
success_url = reverse_lazy('com:poster_list') success_url = reverse_lazy('com:poster_list')
def get_context_data(self, **kwargs):
kwargs = super(PosterEditView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs
class PosterEditView(IsComAdminMixin, ComTabsMixin, UpdateView): class PosterEditView(IsComAdminMixin, ComTabsMixin, UpdateView):
"""Edit communication poster""" """Edit communication poster"""
pk_url_kwarg = "poster_id" pk_url_kwarg = "poster_id"
current_tab = "posters" current_tab = "posters"
model = Poster form_class = PosterForm
fields = ['name', 'file', 'screens', 'date_begin', 'date_end'] template_name = 'core/poster_edit.jinja'
template_name = 'com/poster_edit.jinja'
success_url = reverse_lazy('com:poster_list') success_url = reverse_lazy('com:poster_list')
def get_context_data(self, **kwargs):
kwargs = super(PosterEditView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs
def get_queryset(self):
return Poster.objects.all()
class PosterDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView): class PosterDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView):
"""Delete communication poster""" """Delete communication poster"""
@ -537,15 +549,20 @@ class PosterModerateListView(IsComAdminMixin, ComTabsMixin, ListView):
"""Moderate list communication poster""" """Moderate list communication poster"""
current_tab = "posters" current_tab = "posters"
model = Poster model = Poster
template_name = 'com/poster_moderate.jinja' template_name = 'core/poster_moderate.jinja'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterModerateListView, self).get_context_data(**kwargs) kwargs = super(PosterModerateListView, self).get_context_data(**kwargs)
kwargs['moderation_url'] = 'com:poster_moderate' kwargs['moderation_url'] = 'com:poster_moderate'
kwargs['object_list'] = Poster.objects.filter(is_moderated=False).all() kwargs['object_list'] = Poster.objects.filter(is_moderated=False).all()
kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs return kwargs
class PosterModerateView(IsComAdminMixin, ComTabsMixin, ModerateView): class PosterModerateView(IsComAdminMixin, ComTabsMixin, View):
"""Moderate communication poster""" """Moderate communication poster"""
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
obj = get_object_or_404(Poster, pk=kwargs['object_id']) obj = get_object_or_404(Poster, pk=kwargs['object_id'])
@ -556,19 +573,36 @@ class PosterModerateView(IsComAdminMixin, ComTabsMixin, ModerateView):
return redirect('com:poster_moderate_list') return redirect('com:poster_moderate_list')
raise PermissionDenied raise PermissionDenied
def get_context_data(self, **kwargs):
kwargs = super(PosterModerateListView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs
class ScreenListView(IsComAdminMixin, ComTabsMixin, ListView): class ScreenListView(IsComAdminMixin, ComTabsMixin, ListView):
"""List communication screens""" """List communication screens"""
current_tab = "screens" current_tab = "screens"
model = Screen model = Screen
template_name = 'com/screen_list.jinja' template_name = 'core/screen_list.jinja'
def get_context_data(self, **kwargs):
kwargs = super(ScreenListView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['screen_create_url_name'] = "com:screen_create"
kwargs['screen_edit_url_name'] = "com:screen_edit"
kwargs['screen_list_url_name'] = "com:screen_list"
return kwargs
class ScreenSlideshowView(DetailView): class ScreenSlideshowView(DetailView):
"""Slideshow of actives posters""" """Slideshow of actives posters"""
pk_url_kwarg = "screen_id" pk_url_kwarg = "screen_id"
model = Screen model = Screen
template_name = 'com/screen_slideshow.jinja' template_name = 'core/screen_slideshow.jinja'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(ScreenSlideshowView, self).get_context_data(**kwargs) kwargs = super(ScreenSlideshowView, self).get_context_data(**kwargs)
@ -580,21 +614,39 @@ class ScreenCreateView(IsComAdminMixin, ComTabsMixin, CreateView):
"""Create communication screen""" """Create communication screen"""
current_tab = "screens" current_tab = "screens"
model = Screen model = Screen
fields = ['name', 'club'] fields = ['name', ]
template_name = 'core/create.jinja' template_name = 'core/create.jinja'
success_url = reverse_lazy('com:screen_list') success_url = reverse_lazy('com:screen_list')
def get_context_data(self, **kwargs):
kwargs = super(ScreenCreateView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['screen_create_url_name'] = "com:screen_create"
kwargs['screen_edit_url_name'] = "com:screen_edit"
kwargs['screen_list_url_name'] = "com:screen_list"
return kwargs
class ScreenEditView(IsComAdminMixin, ComTabsMixin, UpdateView): class ScreenEditView(IsComAdminMixin, ComTabsMixin, UpdateView):
"""Edit communication screen""" """Edit communication screen"""
pk_url_kwarg = "screen_id" pk_url_kwarg = "screen_id"
current_tab = "screens" current_tab = "screens"
model = Screen model = Screen
fields = ['name', 'club'] fields = ['name', ]
template_name = 'com/screen_edit.jinja' template_name = 'core/screen_edit.jinja'
success_url = reverse_lazy('com:screen_list') success_url = reverse_lazy('com:screen_list')
def get_context_data(self, **kwargs):
kwargs = super(ScreenEditView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['screen_create_url_name'] = "com:screen_create"
kwargs['screen_edit_url_name'] = "com:screen_edit"
kwargs['screen_list_url_name'] = "com:screen_list"
return kwargs
class ScreenDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView): class ScreenDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView):
"""Delete communication screen""" """Delete communication screen"""
pk_url_kwarg = "screen_id" pk_url_kwarg = "screen_id"

View File

@ -518,6 +518,9 @@ class User(AbstractBaseUser):
infos.save() infos.save()
return infos return infos
def get_clubs_with_rights(self):
return [m.club.id for m in self.memberships.filter(end_date__gte=timezone.now()).all() if m.club.has_rights_in_club(self)]
class AnonymousUser(AuthAnonymousUser): class AnonymousUser(AuthAnonymousUser):
def __init__(self, request): def __init__(self, request):

View File

@ -9,7 +9,7 @@
<div id="title"> <div id="title">
<div id="links" class="left"> <div id="links" class="left">
<a id="list" class="link" href="{{ url("com:poster_list") }}">{% trans %}List{% endtrans %}</a> <a id="list" class="link" href="{{ url(poster_list_url_name) }}">{% trans %}List{% endtrans %}</a>
</div> </div>
<h3>{% trans %}Posters - edit{% endtrans %}</h3> <h3>{% trans %}Posters - edit{% endtrans %}</h3>
<div id="links" class="right"> <div id="links" class="right">

View File

@ -16,26 +16,28 @@
<div id="title"> <div id="title">
<h3>{% trans %}Posters{% endtrans %}</h3> <h3>{% trans %}Posters{% endtrans %}</h3>
<div id="links" class="right"> <div id="links" class="right">
<a id="create" class="link" href="{{ url("com:poster_create") }}">{% trans %}Create{% endtrans %}</a> <a id="create" class="link" href="{{ url(poster_create_url_name) }}">{% trans %}Create{% endtrans %}</a>
<a id="moderation" class="link" href="{{ url("com:poster_moderate_list") }}">{% trans %}Moderation{% endtrans %}</a> {% if app == "com" %}
<a id="moderation" class="link" href="{{ url("com:poster_moderate_list") }}">{% trans %}Moderation{% endtrans %}</a>
{% endif %}
</div> </div>
</div> </div>
<div id="posters"> <div id="posters">
{% if posters.count() == 0 %} {% if poster_list.count() == 0 %}
<div id="no-posters">{% trans %}No posters{% endtrans %}</div> <div id="no-posters">{% trans %}No posters{% endtrans %}</div>
{% else %} {% else %}
{% for poster in posters %} {% for poster in poster_list %}
<div class="poster"> <div class="poster">
<div class="name">{{ poster.name }}</div> <div class="name">{{ poster.name }}</div>
<div class="image"><img src="{{ static(poster.file.url) }}"></img></div> <div class="image"><img src="{{ poster.file.url }}"></img></div>
<div class="dates"> <div class="dates">
<div class="begin">{{ poster.date_begin | date("d/M/Y H:m") }}</div> <div class="begin">{{ poster.date_begin | date("d/M/Y H:m") }}</div>
<div class="end">{{ poster.date_end | date("d/M/Y H:m") }}</div> <div class="end">{{ poster.date_end | date("d/M/Y H:m") }}</div>
</div> </div>
<a class="edit" href="{{ url("com:poster_edit", poster.id) }}">{% trans %}Edit{% endtrans %}</a> <a class="edit" href="{{ url(poster_edit_url_name, poster.id) }}">{% trans %}Edit{% endtrans %}</a>
</div> </div>
{% endfor %} {% endfor %}

View File

@ -24,7 +24,7 @@
{% for poster in object_list %} {% for poster in object_list %}
<div class="poster"> <div class="poster">
<div class="name"> {{ poster.name }} </div> <div class="name"> {{ poster.name }} </div>
<div class="image"> <img src="{{ static(poster.file.url) }}"></img> </div> <div class="image"> <img src="{{ poster.file.url }}"></img> </div>
<a class="moderate" href="{{ url(moderation_url, object_id=poster.id) }}">Moderate</a> <a class="moderate" href="{{ url(moderation_url, object_id=poster.id) }}">Moderate</a>
</div> </div>
{% endfor %} {% endfor %}

View File

@ -9,7 +9,7 @@
<div id="title"> <div id="title">
<div id="links" class="left"> <div id="links" class="left">
<a id="list" class="link" href="{{ url("com:poster_list") }}">{% trans %}List{% endtrans %}</a> <a id="list" class="link" href="{{ url(screen_list_url_name) }}">{% trans %}List{% endtrans %}</a>
</div> </div>
<h3>{% trans %}Screen - edit{% endtrans %}</h3> <h3>{% trans %}Screen - edit{% endtrans %}</h3>
<div id="links" class="right"> <div id="links" class="right">

View File

@ -10,7 +10,7 @@
<div id="title"> <div id="title">
<h3>{% trans %}Screens{% endtrans %}</h3> <h3>{% trans %}Screens{% endtrans %}</h3>
<div id="links" class="right"> <div id="links" class="right">
<a id="create" class="link" href="{{ url("com:screen_create") }}">{% trans %}Create{% endtrans %}</a> <a id="create" class="link" href="{{ url(screen_create_url_name) }}">{% trans %}Create{% endtrans %}</a>
</div> </div>
</div> </div>
@ -23,8 +23,7 @@
{% for screen in screen_list %} {% for screen in screen_list %}
<div class="screen"> <div class="screen">
<div class="name">{{ screen.name }}</div> <div class="name">{{ screen.name }}</div>
<div class="club">Club: {{ screen.club }}</div> <a class="edit" href="{{ url(screen_edit_url_name, screen.id) }}">{% trans %}Edit{% endtrans %}</a>
<a class="edit" href="{{ url("com:screen_edit", screen.id) }}">{% trans %}Edit{% endtrans %}</a>
<a class="slideshow" href="{{ url("com:screen_slideshow", screen.id) }}" target="_blank">{% trans %}Slideshow{% endtrans %}</a> <a class="slideshow" href="{{ url("com:screen_slideshow", screen.id) }}" target="_blank">{% trans %}Slideshow{% endtrans %}</a>
</div> </div>
{% endfor %} {% endfor %}

View File

@ -10,7 +10,7 @@
<div id="slides"> <div id="slides">
{% for poster in posters %} {% for poster in posters %}
<div class="slide {% if loop.first %}center{% else %}right{% endif %}"> <div class="slide {% if loop.first %}center{% else %}right{% endif %}">
<img src="{{ static(poster.file.url) }}"></img> <img src="{{ poster.file.url }}"></img>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -87,6 +87,8 @@
<li><a href="{{ url('com:info_edit') }}">{% trans %}Edit information message{% endtrans %}</a></li> <li><a href="{{ url('com:info_edit') }}">{% trans %}Edit information message{% endtrans %}</a></li>
<li><a href="{{ url('core:file_moderation') }}">{% trans %}Moderate files{% endtrans %}</a></li> <li><a href="{{ url('core:file_moderation') }}">{% trans %}Moderate files{% endtrans %}</a></li>
<li><a href="{{ url('com:mailing_admin') }}">{% trans %}Mailing lists administration{% endtrans %}</a></li> <li><a href="{{ url('com:mailing_admin') }}">{% trans %}Mailing lists administration{% endtrans %}</a></li>
<li><a href="{{ url('com:poster_list') }}">{% trans %}Posters{% endtrans %}</a></li>
<li><a href="{{ url('com:screen_list') }}">{% trans %}Screens{% endtrans %}</a></li>
{% endif %} {% endif %}
{% if user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) %} {% if user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID) %}
<li><a href="{{ url('sas:moderation') }}">{% trans %}Moderate pictures{% endtrans %}</a></li> <li><a href="{{ url('sas:moderation') }}">{% trans %}Moderate pictures{% endtrans %}</a></li>

View File

@ -37,12 +37,12 @@ from ajax_select.fields import AutoCompleteSelectField
import re import re
from core.models import User, Page, SithFile, Gift from core.models import User, Page, SithFile, Gift
from com.models import Poster, Screen
from core.utils import resize_image from core.utils import resize_image
from io import BytesIO from io import BytesIO
from PIL import Image from PIL import Image
# Widgets # Widgets
class SelectSingle(Select): class SelectSingle(Select):