diff --git a/prednasky/admin.py b/prednasky/admin.py index a1d0e63c..f09310a0 100644 --- a/prednasky/admin.py +++ b/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']