|
@ -3,7 +3,7 @@ |
|
|
from django.contrib import admin |
|
|
from django.contrib import admin |
|
|
from django import forms |
|
|
from django import forms |
|
|
from django.forms import widgets |
|
|
from django.forms import widgets |
|
|
import reversion |
|
|
from reversion.admin import VersionAdmin |
|
|
from solo.admin import SingletonModelAdmin |
|
|
from solo.admin import SingletonModelAdmin |
|
|
from ckeditor.widgets import CKEditorWidget |
|
|
from ckeditor.widgets import CKEditorWidget |
|
|
from django.db.models import Count |
|
|
from django.db.models import Count |
|
@ -165,7 +165,7 @@ class Soustredeni_UcastniciInline(admin.TabularInline): |
|
|
|
|
|
|
|
|
### Resitel |
|
|
### Resitel |
|
|
|
|
|
|
|
|
class ResitelAdmin(reversion.VersionAdmin): |
|
|
class ResitelAdmin(VersionAdmin): |
|
|
form = autocomplete_light.modelform_factory(Resitel, autocomplete_fields=['skola'], fields=['skola']) |
|
|
form = autocomplete_light.modelform_factory(Resitel, autocomplete_fields=['skola'], fields=['skola']) |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['jmeno', 'prijmeni', 'user']}), |
|
|
(None, {'fields': ['jmeno', 'prijmeni', 'user']}), |
|
@ -192,7 +192,7 @@ admin.site.register(Resitel, ResitelAdmin) |
|
|
|
|
|
|
|
|
### Skola |
|
|
### Skola |
|
|
|
|
|
|
|
|
class SkolaAdmin(reversion.VersionAdmin): |
|
|
class SkolaAdmin(VersionAdmin): |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['nazev', 'kratky_nazev', 'je_zs', 'je_ss']}), |
|
|
(None, {'fields': ['nazev', 'kratky_nazev', 'je_zs', 'je_ss']}), |
|
|
(u'Interní ID', {'fields': ['aesop_id', 'izo'], 'classes': ['collapse']}), |
|
|
(u'Interní ID', {'fields': ['aesop_id', 'izo'], 'classes': ['collapse']}), |
|
@ -209,7 +209,7 @@ admin.site.register(Skola, SkolaAdmin) |
|
|
|
|
|
|
|
|
### Cislo |
|
|
### Cislo |
|
|
|
|
|
|
|
|
class CisloAdmin(reversion.VersionAdmin): |
|
|
class CisloAdmin(VersionAdmin): |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['cislo', 'rocnik', 'verejne_db', 'verejna_vysledkovka', 'poznamka', 'pdf']}), |
|
|
(None, {'fields': ['cislo', 'rocnik', 'verejne_db', 'verejna_vysledkovka', 'poznamka', 'pdf']}), |
|
|
(u'Data', {'fields': ['datum_vydani', 'datum_deadline']}), |
|
|
(u'Data', {'fields': ['datum_vydani', 'datum_deadline']}), |
|
@ -232,7 +232,7 @@ admin.site.register(Cislo, CisloAdmin) |
|
|
|
|
|
|
|
|
### Rocnik |
|
|
### Rocnik |
|
|
|
|
|
|
|
|
class RocnikAdmin(reversion.VersionAdmin): |
|
|
class RocnikAdmin(VersionAdmin): |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['rocnik', 'prvni_rok', 'exportovat']}), |
|
|
(None, {'fields': ['rocnik', 'prvni_rok', 'exportovat']}), |
|
|
] |
|
|
] |
|
@ -264,7 +264,7 @@ admin.site.register(Rocnik, RocnikAdmin) |
|
|
|
|
|
|
|
|
### Reseni |
|
|
### Reseni |
|
|
|
|
|
|
|
|
class ReseniAdmin(reversion.VersionAdmin): |
|
|
class ReseniAdmin(VersionAdmin): |
|
|
form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['problem', 'resitel'], fields=['problem', 'resitel']) |
|
|
form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['problem', 'resitel'], fields=['problem', 'resitel']) |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['problem', 'resitel', 'forma', 'body', 'cislo_body', 'timestamp']}), |
|
|
(None, {'fields': ['problem', 'resitel', 'forma', 'body', 'cislo_body', 'timestamp']}), |
|
@ -299,7 +299,7 @@ class ProblemAdminForm(forms.ModelForm): |
|
|
model = Problem |
|
|
model = Problem |
|
|
exclude = [] |
|
|
exclude = [] |
|
|
|
|
|
|
|
|
class ProblemAdmin(reversion.VersionAdmin): |
|
|
class ProblemAdmin(VersionAdmin): |
|
|
form = ProblemAdminForm |
|
|
form = ProblemAdminForm |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['nazev', 'typ', 'stav', 'autor', 'zamereni', 'body', 'timestamp', 'import_dakos_id']}), |
|
|
(None, {'fields': ['nazev', 'typ', 'stav', 'autor', 'zamereni', 'body', 'timestamp', 'import_dakos_id']}), |
|
@ -354,7 +354,7 @@ class SoustredeniAdminForm(forms.ModelForm): |
|
|
model = Soustredeni |
|
|
model = Soustredeni |
|
|
exclude = [] |
|
|
exclude = [] |
|
|
|
|
|
|
|
|
class SoustredeniAdmin(reversion.VersionAdmin): |
|
|
class SoustredeniAdmin(VersionAdmin): |
|
|
form = SoustredeniAdminForm |
|
|
form = SoustredeniAdminForm |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['rocnik', 'misto', 'typ', 'verejne_db', 'exportovat', 'text']}), |
|
|
(None, {'fields': ['rocnik', 'misto', 'typ', 'verejne_db', 'exportovat', 'text']}), |
|
@ -399,7 +399,7 @@ def zneverejnit_novinky(modeladmin, request, queryset): |
|
|
zneverejnit_novinky.short_description = 'Zneveřejnit vybrané novinky' |
|
|
zneverejnit_novinky.short_description = 'Zneveřejnit vybrané novinky' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NovinkyAdmin(admin.ModelAdmin): |
|
|
class NovinkyAdmin(VersionAdmin): |
|
|
form = NovinkyAdminForm |
|
|
form = NovinkyAdminForm |
|
|
list_display = ['datum', 'autor', 'text', 'zverejneno', 'obrazek'] |
|
|
list_display = ['datum', 'autor', 'text', 'zverejneno', 'obrazek'] |
|
|
actions = [zverejnit_novinky, zneverejnit_novinky] |
|
|
actions = [zverejnit_novinky, zneverejnit_novinky] |
|
@ -444,7 +444,7 @@ deaktivovat_organizatory.short_description = 'Deaktivovat organizátory' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Organizator) |
|
|
@admin.register(Organizator) |
|
|
class OrganizatorAdmin(admin.ModelAdmin): |
|
|
class OrganizatorAdmin(VersionAdmin): |
|
|
list_filter = ['organizuje_do_roku'] |
|
|
list_filter = ['organizuje_do_roku'] |
|
|
list_display = [jmeno_organizatora, je_organizator_aktivni,] |
|
|
list_display = [jmeno_organizatora, je_organizator_aktivni,] |
|
|
actions = [zaktivovat_organizatory, deaktivovat_organizatory,] |
|
|
actions = [zaktivovat_organizatory, deaktivovat_organizatory,] |
|
|