|
@ -1,6 +1,7 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
from django.contrib import admin |
|
|
from django.contrib import admin |
|
|
from django import forms |
|
|
from django import forms |
|
|
|
|
|
import reversion |
|
|
from solo.admin import SingletonModelAdmin |
|
|
from solo.admin import SingletonModelAdmin |
|
|
from ckeditor.widgets import CKEditorWidget |
|
|
from ckeditor.widgets import CKEditorWidget |
|
|
|
|
|
|
|
@ -12,7 +13,7 @@ admin.site.register(Nastaveni, SingletonModelAdmin) |
|
|
|
|
|
|
|
|
### Skola |
|
|
### Skola |
|
|
|
|
|
|
|
|
class SkolaAdmin(admin.ModelAdmin): |
|
|
class SkolaAdmin(reversion.VersionAdmin, admin.ModelAdmin): |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['nazev', 'kratky_nazev']}), |
|
|
(None, {'fields': ['nazev', 'kratky_nazev']}), |
|
|
(u'Interní ID', {'fields': ['aesop_id', 'izo'], 'classes': ['collapse']}), |
|
|
(u'Interní ID', {'fields': ['aesop_id', 'izo'], 'classes': ['collapse']}), |
|
@ -26,7 +27,7 @@ admin.site.register(Skola, SkolaAdmin) |
|
|
|
|
|
|
|
|
### Resitel |
|
|
### Resitel |
|
|
|
|
|
|
|
|
class ResitelAdmin(admin.ModelAdmin): |
|
|
class ResitelAdmin(reversion.VersionAdmin, admin.ModelAdmin): |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['jmeno', 'prijmeni', 'user']}), |
|
|
(None, {'fields': ['jmeno', 'prijmeni', 'user']}), |
|
|
(u'Škola', {'fields': ['skola', 'rok_maturity']}), |
|
|
(u'Škola', {'fields': ['skola', 'rok_maturity']}), |
|
@ -43,7 +44,7 @@ admin.site.register(Resitel, ResitelAdmin) |
|
|
|
|
|
|
|
|
### Cislo |
|
|
### Cislo |
|
|
|
|
|
|
|
|
class CisloAdmin(admin.ModelAdmin): |
|
|
class CisloAdmin(reversion.VersionAdmin, admin.ModelAdmin): |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['cislo', 'rocnik']}), |
|
|
(None, {'fields': ['cislo', 'rocnik']}), |
|
|
(u'Data', {'fields': ['datum_vydani', 'datum_deadline']}), |
|
|
(u'Data', {'fields': ['datum_vydani', 'datum_deadline']}), |
|
@ -60,7 +61,7 @@ class CisloInline(admin.StackedInline): |
|
|
|
|
|
|
|
|
### Rocnik |
|
|
### Rocnik |
|
|
|
|
|
|
|
|
class RocnikAdmin(admin.ModelAdmin): |
|
|
class RocnikAdmin(reversion.VersionAdmin, admin.ModelAdmin): |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['rocnik', 'prvni_rok']}), |
|
|
(None, {'fields': ['rocnik', 'prvni_rok']}), |
|
|
] |
|
|
] |
|
@ -72,7 +73,7 @@ admin.site.register(Rocnik, RocnikAdmin) |
|
|
|
|
|
|
|
|
### PrilohaReseni |
|
|
### PrilohaReseni |
|
|
|
|
|
|
|
|
class PrilohaReseniAdmin(admin.ModelAdmin): |
|
|
class PrilohaReseniAdmin(reversion.VersionAdmin, admin.ModelAdmin): |
|
|
readonly_fields = ['timestamp'] |
|
|
readonly_fields = ['timestamp'] |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['reseni', 'soubor', 'timestamp']}), |
|
|
(None, {'fields': ['reseni', 'soubor', 'timestamp']}), |
|
@ -90,7 +91,7 @@ class PrilohaReseniInline(admin.StackedInline): |
|
|
|
|
|
|
|
|
### Reseni |
|
|
### Reseni |
|
|
|
|
|
|
|
|
class ReseniAdmin(admin.ModelAdmin): |
|
|
class ReseniAdmin(reversion.VersionAdmin, admin.ModelAdmin): |
|
|
readonly_fields = ['timestamp'] |
|
|
readonly_fields = ['timestamp'] |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|
(None, {'fields': ['problem', 'resitel', 'body', 'cislo_body', 'timestamp']}), |
|
|
(None, {'fields': ['problem', 'resitel', 'body', 'cislo_body', 'timestamp']}), |
|
@ -102,7 +103,7 @@ class ReseniAdmin(admin.ModelAdmin): |
|
|
|
|
|
|
|
|
admin.site.register(Reseni, ReseniAdmin) |
|
|
admin.site.register(Reseni, ReseniAdmin) |
|
|
|
|
|
|
|
|
class ReseniInline(admin.StackedInline): |
|
|
class ReseniInline(admin.TabularInline): |
|
|
model = Reseni |
|
|
model = Reseni |
|
|
extra = 0 |
|
|
extra = 0 |
|
|
|
|
|
|
|
@ -116,7 +117,7 @@ class ProblemAdminForm(forms.ModelForm): |
|
|
model = Problem |
|
|
model = Problem |
|
|
exclude = [] |
|
|
exclude = [] |
|
|
|
|
|
|
|
|
class ProblemAdmin(admin.ModelAdmin): |
|
|
class ProblemAdmin(reversion.VersionAdmin, admin.ModelAdmin): |
|
|
form = ProblemAdminForm |
|
|
form = ProblemAdminForm |
|
|
# readonly_fields = ['autor'] |
|
|
# readonly_fields = ['autor'] |
|
|
fieldsets = [ |
|
|
fieldsets = [ |
|
|