Zrychleni nacitani seznamu prednasek.
This commit is contained in:
parent
f498c0303a
commit
d4c878b22d
1 changed files with 16 additions and 9 deletions
|
@ -10,17 +10,24 @@ from models import Prednaska, Seznam, STAV_NAVRH
|
||||||
from seminar.models import Soustredeni
|
from seminar.models import Soustredeni
|
||||||
|
|
||||||
class Seznam_PrednaskaInline(admin.TabularInline):
|
class Seznam_PrednaskaInline(admin.TabularInline):
|
||||||
# form = autocomplete_light.modelform_factory(Prednaska, autocomplete_fields=['nazev'], fields=['nazev'])
|
|
||||||
model = Prednaska.seznamy.through
|
model = Prednaska.seznamy.through
|
||||||
# fields = ['nazev', 'org', 'obor' ]
|
fields = ('nazev','obor','org')
|
||||||
# extra = 0
|
readonly_fields = ('nazev','obor','org')
|
||||||
# formfield_overrides = {
|
can_delete = True
|
||||||
# models.TextField: {'widget': forms.TextInput},
|
|
||||||
# }
|
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):
|
def get_queryset(self, request):
|
||||||
# qs = super(Seznam_PrednaskaInline, self).get_queryset(request)
|
qs = super(Seznam_PrednaskaInline, self).get_queryset(request)
|
||||||
# return qs.select_related('seznam', 'prednaska')
|
return qs.select_related('prednaska', 'prednaska__org')
|
||||||
|
|
||||||
class SeznamAdmin(VersionAdmin):
|
class SeznamAdmin(VersionAdmin):
|
||||||
list_display = ['soustredeni','stav']
|
list_display = ['soustredeni','stav']
|
||||||
|
|
Loading…
Reference in a new issue