Browse Source

Merge branch 'python3' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into python3

export_seznamu_prednasek
Anet 6 years ago
parent
commit
86193f1fb9
  1. 23
      seminar/admin.py

23
seminar/admin.py

@ -76,11 +76,20 @@ def create_modeladmin(modeladmin, model, name = None, verbose_name = None, verbo
class ResitelInline(admin.TabularInline): class ResitelInline(admin.TabularInline):
model = Resitel model = Resitel
fields = ['jmeno', 'prijmeni', 'skola', 'mesto', 'rok_maturity', ] fields = ['osoba_jmeno', 'osoba_prijmeni', 'skola', 'osoba_mesto', 'rok_maturity', ]
readonly_fields = ['jmeno', 'prijmeni', 'skola', 'mesto', 'rok_maturity', ] readonly_fields = ['osoba_jmeno', 'osoba_prijmeni', 'skola', 'osoba_mesto', 'rok_maturity', ]
extra = 0 extra = 0
view_on_site = False view_on_site = False
def osoba_jmeno(self, obj):
return obj.osoba.jmeno
def osoba_prijmeni(self, obj):
return obj.osoba.prijmeni
def osoba_mesto(self, obj):
return obj.osoba.mesto
def has_add_permission(self, req): return False def has_add_permission(self, req): return False
@ -347,14 +356,14 @@ admin.site.register(Rocnik, RocnikAdmin)
class ReseniAdmin(VersionAdmin): class ReseniAdmin(VersionAdmin):
#form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['problem', 'resitele'], fields=['problem', 'resitele']) #form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['problem', 'resitele'], fields=['problem', 'resitele'])
fieldsets = [ fieldsets = [
(None, {'fields': ['problem', 'resitele', 'forma', 'body', 'cislo_body', 'timestamp']}), (None, {'fields': ['problem__set', 'resitele__set', 'forma', 'cas_doruceni']}),
(u'Poznámky', {'fields': ['poznamka']}), (u'Poznámky', {'fields': ['poznamka']}),
] ]
readonly_fields = ['timestamp'] readonly_fields = ['cas_doruceni']
list_display = ['problem', 'resitele', 'forma', 'body', 'timestamp', 'cislo_body'] list_display = [ProblemInline, ResitelInline, 'forma', 'cas_doruceni']
list_filter = ['body', 'timestamp', 'forma'] list_filter = ['cas_doruceni', 'forma']
search_fields = [] search_fields = []
inlines = [PrilohaReseniInline] inlines = [PrilohaReseniInline,ProblemInline,ResitelInline]
view_on_site = False view_on_site = False
def get_queryset(self, request): def get_queryset(self, request):

Loading…
Cancel
Save