Galerie: Možnost úpravy pořadí fotek
This commit is contained in:
parent
d2367d28fb
commit
ec8ac3e309
2 changed files with 5 additions and 5 deletions
|
@ -31,20 +31,20 @@ def prepnout_fotogalerii_do_org_rezimu(modeladmin, request, queryset):
|
||||||
|
|
||||||
class GalerieInline(admin.TabularInline):
|
class GalerieInline(admin.TabularInline):
|
||||||
model = Obrazek
|
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']
|
readonly_fields = ['nazev', 'obrazek_maly_tag']
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
models.TextField: {'widget': forms.TextInput},
|
models.TextField: {'widget': forms.TextInput},
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObrazekAdmin(admin.ModelAdmin):
|
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):
|
class GalerieAdmin(admin.ModelAdmin):
|
||||||
form = autocomplete_light.modelform_factory(Galerie, autocomplete_fields=['titulni_obrazek'], fields=['titulni_obrazek'])
|
form = autocomplete_light.modelform_factory(Galerie, autocomplete_fields=['titulni_obrazek'], fields=['titulni_obrazek'])
|
||||||
model = Galerie
|
model = Galerie
|
||||||
fields = ('zobrazit', 'nazev', 'titulni_obrazek', 'popis', 'galerie_up', 'soustredeni', 'poradi')
|
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]
|
inlines = [GalerieInline]
|
||||||
actions = [zverejnit_fotogalerii, prepnout_fotogalerii_do_org_rezimu]
|
actions = [zverejnit_fotogalerii, prepnout_fotogalerii_do_org_rezimu]
|
||||||
save_on_top = True
|
save_on_top = True
|
||||||
|
|
|
@ -38,7 +38,7 @@ def nahled(request, pk, soustredeni):
|
||||||
if not request.user.is_staff:
|
if not request.user.is_staff:
|
||||||
podgalerie = podgalerie.filter(zobrazit__lt=1)
|
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)
|
preview = zobrazit(galerie, request)
|
||||||
|
|
||||||
sourozenci = []
|
sourozenci = []
|
||||||
|
@ -82,7 +82,7 @@ def detail(request, pk, fotka, soustredeni):
|
||||||
galerie = get_object_or_404(Galerie, pk=pk)
|
galerie = get_object_or_404(Galerie, pk=pk)
|
||||||
preview = zobrazit(galerie, request)
|
preview = zobrazit(galerie, request)
|
||||||
obrazek = get_object_or_404(Obrazek, pk=fotka)
|
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
|
# vytvoreni a obslouzeni formulare
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
Loading…
Reference in a new issue