From f33be6c2e923fd81513a72685097d8a7d6bab96c Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Thu, 14 May 2015 16:57:12 +0200 Subject: [PATCH] Dalsi update adminu --- seminar/admin.py | 12 +++++++++--- seminar/models.py | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/seminar/admin.py b/seminar/admin.py index 8df88bca..8cbd595d 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -51,8 +51,9 @@ class CisloAdmin(reversion.VersionAdmin): (u'Data', {'fields': ['datum_vydani', 'datum_deadline']}), ] list_display = ['kod', 'rocnik', 'cislo', 'datum_vydani', 'datum_deadline', 'verejne'] - list_display_links = ['rocnik'] + list_display_links = ['cislo', 'kod'] list_filter = ['rocnik'] + view_on_site = Cislo.verejne_url admin.site.register(Cislo, CisloAdmin) @@ -69,6 +70,7 @@ class RocnikAdmin(reversion.VersionAdmin): ] list_display = ['rocnik', 'prvni_rok', 'verejne'] inlines = [CisloInline] + view_on_site = Rocnik.verejne_url admin.site.register(Rocnik, RocnikAdmin) @@ -111,6 +113,7 @@ admin.site.register(Reseni, ReseniAdmin) class ReseniInline(admin.TabularInline): model = Reseni + readonly_fields = ['poznamka'] extra = 0 @@ -131,11 +134,13 @@ class ProblemAdmin(reversion.VersionAdmin): (u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel']}), (u'Texty', {'fields': ['text_problemu', 'text_problemu_org']}), ] - list_display = ['kod', 'nazev', 'typ', 'stav', 'autor', 'opravovatel', 'verejne', 'cislo_zadani'] - list_display_links = ['autor', 'opravovatel', 'cislo_zadani'] + list_display = ['nazev', 'typ', 'kod', 'stav', 'autor', 'opravovatel', 'verejne', 'cislo_zadani'] + list_select_related = True + list_display_links = ['nazev'] list_filter = ['typ', 'stav', 'autor', 'opravovatel'] search_fields = ['nazev', 'kod', 'text_problemu_org', 'text_problemu'] inlines = [ReseniInline] + view_on_site = Problem.verejne_url admin.site.register(Problem, ProblemAdmin) @@ -149,5 +154,6 @@ class SoustredeniAdmin(reversion.VersionAdmin): ] list_display = ['rocnik', 'misto', 'datum_zacatku', 'verejne'] list_filter = ['rocnik'] + view_on_site = Soustredeni.verejne_url admin.site.register(Soustredeni, SoustredeniAdmin) diff --git a/seminar/models.py b/seminar/models.py index 06154363..f5021fd4 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -199,7 +199,7 @@ class Rocnik(SeminarModelBase): return force_unicode(self.rocnik) def verejne(self): - return len(self.verejne_cisla()) > 0 + return len(self.verejna_cisla()) > 0 verejne.boolean = True def verejna_cisla(self): @@ -359,7 +359,7 @@ class Reseni(SeminarModelBase): timestamp = models.DateTimeField(u'vytvořeno', auto_now=True) poznamka = models.TextField(u'neveřejná poznámka', blank=True, - help_text=u'Neveřejná poznámka k řešení (plain text)') + help_text=u'Neveřejná poznámka k řešení (plain text, editace v detailu řešení)') def __str__(self): return force_unicode(u"%s: %s (%sb)" % (self.resitel.plne_jmeno(), self.problem.nazev, self.body))