|
@ -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 |
|
|
# def get_queryset(self, request): |
|
|
return obj.prednaska.nazev |
|
|
# qs = super(Seznam_PrednaskaInline, self).get_queryset(request) |
|
|
def obor(self,obj): |
|
|
# return qs.select_related('seznam', 'prednaska') |
|
|
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): |
|
|
class SeznamAdmin(VersionAdmin): |
|
|
list_display = ['soustredeni','stav'] |
|
|
list_display = ['soustredeni','stav'] |
|
|