Browse Source

Zrychleni nacitani seznamu prednasek.

remotes/origin/prednasky
Tomas Jethro Pokorny 8 years ago
parent
commit
d4c878b22d
  1. 27
      prednasky/admin.py

27
prednasky/admin.py

@ -10,17 +10,24 @@ from models import Prednaska, Seznam, STAV_NAVRH
from seminar.models import Soustredeni
class Seznam_PrednaskaInline(admin.TabularInline):
# form = autocomplete_light.modelform_factory(Prednaska, autocomplete_fields=['nazev'], fields=['nazev'])
model = Prednaska.seznamy.through
# fields = ['nazev', 'org', 'obor' ]
# extra = 0
# formfield_overrides = {
# models.TextField: {'widget': forms.TextInput},
# }
# def get_queryset(self, request):
# qs = super(Seznam_PrednaskaInline, self).get_queryset(request)
# return qs.select_related('seznam', 'prednaska')
fields = ('nazev','obor','org')
readonly_fields = ('nazev','obor','org')
can_delete = True
def nazev(self,obj):
print self,obj
return obj.prednaska.nazev
def obor(self,obj):
print self,obj
return obj.prednaska.obor
def org(self,obj):
print self,obj
return obj.prednaska.org
def get_queryset(self, request):
qs = super(Seznam_PrednaskaInline, self).get_queryset(request)
return qs.select_related('prednaska', 'prednaska__org')
class SeznamAdmin(VersionAdmin):
list_display = ['soustredeni','stav']

Loading…
Cancel
Save