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