Browse Source

Admin: django-reverse-admin ukazka a fail s m2m.

export_seznamu_prednasek
parent
commit
65a76935a6
  1. 1
      requirements.txt
  2. 33
      seminar/admin.py

1
requirements.txt

@ -27,6 +27,7 @@ django-crispy-forms
django-imagekit django-imagekit
django-polymorphic django-polymorphic
django-sitetree django-sitetree
django_reverse_admin
# Comments # Comments
akismet==1.0.1 akismet==1.0.1

33
seminar/admin.py

@ -1,6 +1,8 @@
from django.contrib import admin from django.contrib import admin
from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin, PolymorphicChildModelFilter from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin, PolymorphicChildModelFilter
from reversion.admin import VersionAdmin
from django_reverse_admin import ReverseModelAdmin
# Todo: reversion # Todo: reversion
@ -9,7 +11,6 @@ import seminar.models as m
admin.site.register(m.Osoba) admin.site.register(m.Osoba)
admin.site.register(m.Skola) admin.site.register(m.Skola)
admin.site.register(m.Prijemce) admin.site.register(m.Prijemce)
admin.site.register(m.Resitel)
admin.site.register(m.Rocnik) admin.site.register(m.Rocnik)
admin.site.register(m.Cislo) admin.site.register(m.Cislo)
admin.site.register(m.Organizator) admin.site.register(m.Organizator)
@ -39,11 +40,35 @@ class UlohaAdmin(PolymorphicChildModelAdmin):
base_model = m.Uloha base_model = m.Uloha
show_in_index = True show_in_index = True
class TextAdminInline(admin.TabularInline):
model = m.Text
exclude = ['text_zkraceny_set','text_zkraceny']
admin.site.register(m.Text) admin.site.register(m.Text)
admin.site.register(m.Reseni)
admin.site.register(m.Hodnoceni) class ResitelInline(admin.TabularInline):
model = m.Resitel
extra = 1
admin.site.register(m.Resitel)
class PrilohaReseniInline(admin.TabularInline):
model = m.PrilohaReseni
extra = 1
admin.site.register(m.PrilohaReseni) admin.site.register(m.PrilohaReseni)
class Reseni_ResiteleInline(admin.TabularInline):
model = m.Reseni_Resitele
@admin.register(m.Reseni)
class ReseniAdmin(ReverseModelAdmin):
base_model = m.Reseni
inline_type = 'tabular'
inline_reverse = ['text_cely','resitele']
exclude = ['text_zkraceny', 'text_zkraceny_set']
inlines = [PrilohaReseniInline]
# FAIL in template
# inlines = [PrilohaReseniInline,Reseni_ResiteleInline]
admin.site.register(m.Hodnoceni)
admin.site.register(m.Pohadka) admin.site.register(m.Pohadka)
admin.site.register(m.Konfera) admin.site.register(m.Konfera)
admin.site.register(m.Obrazek) admin.site.register(m.Obrazek)

Loading…
Cancel
Save