mamweb/korektury/admin.py

27 lines
662 B
Python
Raw Normal View History

2015-12-01 22:18:28 +01:00
from django.contrib import admin
from reversion.admin import VersionAdmin
from korektury.models import KorekturovanePDF
2015-12-01 22:18:28 +01:00
2015-12-01 22:18:28 +01:00
# Register your models here.
class KorekturovanePDFAdmin(VersionAdmin):
2019-05-11 01:15:05 +02:00
readonly_fields = ['cas', 'stran']
2019-05-11 01:15:05 +02:00
def get_readonly_fields(self, request, obj=None):
if obj:
return self.readonly_fields + ['pdf']
return self.readonly_fields
2019-05-11 01:15:05 +02:00
fieldsets = [
(None,
{'fields':
['pdf', 'cas', 'org', 'stran', 'nazev', 'komentar']}),
# (u'PDF', {'fields': ['pdf']}),
]
list_display = ['nazev', 'cas', 'stran', 'org']
list_filter = []
search_fields = []
admin.site.register(KorekturovanePDF, KorekturovanePDFAdmin)