From b5dda32fee7156fbc935b01a555af4babcdb6886 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 3 Jul 2015 11:18:32 +0200 Subject: [PATCH] soustredeni +action skryti soustredeni --- seminar/admin.py | 8 +++++++- .../templates/seminar/soustredeni/seznam_soustredeni.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/seminar/admin.py b/seminar/admin.py index 9036592f..29954951 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -304,6 +304,12 @@ def zverejnit_soustredeni(modeladmin, request, queryset): soustredeni.save() zverejnit_soustredeni.short_description = 'Zveřejnit soustředění' +def skryt_soustredeni(modeladmin, request, queryset): + for soustredeni in queryset: + soustredeni.verejne_db = False + soustredeni.save() +skryt_soustredeni.short_description = 'Skrýt soustředění (Zneveřjnit)' + class SoustredeniAdminForm(forms.ModelForm): text = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Soustredeni, 'text')) class Meta: @@ -320,7 +326,7 @@ class SoustredeniAdmin(reversion.VersionAdmin): inlines = [Soustredeni_UcastniciInline] list_filter = ['rocnik'] view_on_site = Soustredeni.verejne_url - actions = [zverejnit_soustredeni,] + actions = [zverejnit_soustredeni, skryt_soustredeni, ] admin.site.register(Soustredeni, SoustredeniAdmin) diff --git a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html index 6485fc92..1159f9e6 100644 --- a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html +++ b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html @@ -8,7 +8,7 @@ {% for soustredeni in object_list %} {# Kdyz je verejne -> zobraz #} {% if soustredeni.verejne_db or user.is_authenticated %} - {% if user.is_authenticated %} + {% if not soustredeni.verejne_db and user.is_authenticated %} Groups of user: {{user.groups.all}}