Browse Source

Integrate reversion to seminar, add admin-tools

remotes/origin/feincms
Tomas Gavenciak 10 years ago
parent
commit
cd3097ba5c
  1. 5
      mamweb/settings_common.py
  2. 1
      mamweb/urls.py
  3. 3
      requirements.txt
  4. 17
      seminar/admin.py

5
mamweb/settings_common.py

@ -76,6 +76,11 @@ TEMPLATE_CONTEXT_PROCESSORS = (
) )
INSTALLED_APPS = ( INSTALLED_APPS = (
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
# Basic # Basic
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',

1
mamweb/urls.py

@ -7,6 +7,7 @@ from django.conf import settings
urlpatterns = i18n_patterns('', urlpatterns = i18n_patterns('',
url(r'^admin/', include(admin.site.urls)), # NOQA url(r'^admin/', include(admin.site.urls)), # NOQA
url(r'^admin_tools/', include('admin_tools.urls')),
url(r'^ckeditor/', include('ckeditor.urls')), url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^', include('seminar.urls')), url(r'^', include('seminar.urls')),
) )

3
requirements.txt

@ -6,7 +6,7 @@ Pillow==2.7.0
pytz==2014.10 pytz==2014.10
six==1.9.0 six==1.9.0
# Django # Django and modules
Django==1.7.5 Django==1.7.5
django-bootstrap-sass==0.0.6a0 django-bootstrap-sass==0.0.6a0
@ -16,6 +16,7 @@ django-sekizai==0.8.1
django-countries==3.2 django-countries==3.2
django-solo==1.1.0 django-solo==1.1.0
django-ckeditor==4.4.7 django-ckeditor==4.4.7
django-admin-tools==0.5.2
# debug tools/extensions # debug tools/extensions

17
seminar/admin.py

@ -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 = [

Loading…
Cancel
Save