From ec8ac3e3093fca287954bf174e6dbcf79d7721dd Mon Sep 17 00:00:00 2001 From: LEdoian Date: Wed, 6 Mar 2019 00:52:34 +0100 Subject: [PATCH] =?UTF-8?q?Galerie:=20Mo=C5=BEnost=20=C3=BApravy=20po?= =?UTF-8?q?=C5=99ad=C3=AD=20fotek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- galerie/admin.py | 6 +++--- galerie/views.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/galerie/admin.py b/galerie/admin.py index 8e9c1897..6bae43ac 100644 --- a/galerie/admin.py +++ b/galerie/admin.py @@ -31,20 +31,20 @@ def prepnout_fotogalerii_do_org_rezimu(modeladmin, request, queryset): class GalerieInline(admin.TabularInline): model = Obrazek - fields = ['obrazek_velky', 'nazev', 'popis', 'obrazek_maly_tag'] + fields = ['obrazek_velky', 'nazev', 'popis', 'obrazek_maly_tag', 'poradi'] readonly_fields = ['nazev', 'obrazek_maly_tag'] formfield_overrides = { models.TextField: {'widget': forms.TextInput}, } class ObrazekAdmin(admin.ModelAdmin): - list_display = ('obrazek_velky', 'nazev', 'popis', 'obrazek_maly_tag') + list_display = ('obrazek_velky', 'nazev', 'popis', 'obrazek_maly_tag', 'poradi') class GalerieAdmin(admin.ModelAdmin): form = autocomplete_light.modelform_factory(Galerie, autocomplete_fields=['titulni_obrazek'], fields=['titulni_obrazek']) model = Galerie fields = ('zobrazit', 'nazev', 'titulni_obrazek', 'popis', 'galerie_up', 'soustredeni', 'poradi') - list_display = ('nazev', 'pk', 'poradi', 'datum_zmeny', 'zobrazit', 'soustredeni') + list_display = ('nazev', 'pk', 'poradi', 'datum_zmeny', 'zobrazit', 'soustredeni', 'poradi') inlines = [GalerieInline] actions = [zverejnit_fotogalerii, prepnout_fotogalerii_do_org_rezimu] save_on_top = True diff --git a/galerie/views.py b/galerie/views.py index 46860810..f7ace3c8 100644 --- a/galerie/views.py +++ b/galerie/views.py @@ -38,7 +38,7 @@ def nahled(request, pk, soustredeni): if not request.user.is_staff: podgalerie = podgalerie.filter(zobrazit__lt=1) - obrazky = Obrazek.objects.filter(galerie = galerie) + obrazky = Obrazek.objects.filter(galerie = galerie).order_by('poradi') preview = zobrazit(galerie, request) sourozenci = [] @@ -82,7 +82,7 @@ def detail(request, pk, fotka, soustredeni): galerie = get_object_or_404(Galerie, pk=pk) preview = zobrazit(galerie, request) obrazek = get_object_or_404(Obrazek, pk=fotka) - obrazky = galerie.obrazek_set.all() + obrazky = galerie.obrazek_set.all().order_by('poradi') # vytvoreni a obslouzeni formulare if request.method == 'POST':