fnp
/
prawokultury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
migration fix
[prawokultury.git]
/
migdal
/
admin.py
diff --git
a/migdal/admin.py
b/migdal/admin.py
index
6d4baef
..
d93a782
100644
(file)
--- a/
migdal/admin.py
+++ b/
migdal/admin.py
@@
-2,17
+2,12
@@
# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from migdal.models import Category, Entry, Attachment
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from migdal.models import Category, Entry, Attachment
-from migdal import settings
-
-
-def translated_fields(field_names, languages=settings.LANGUAGES):
- return tuple("%s_%s" % (field_name, lang_code)
- for field_name in field_names
- for lang_code, lang_name in languages
- )
+from migdal import app_settings
+from migdal.helpers import translated_fields
class AttachmentInline(admin.TabularInline):
class AttachmentInline(admin.TabularInline):
@@
-21,26
+16,30
@@
class AttachmentInline(admin.TabularInline):
class EntryAdmin(admin.ModelAdmin):
class EntryAdmin(admin.ModelAdmin):
+ date_hierarchy = 'date'
+ readonly_fields = ('date', 'changed_at') + translated_fields(('published_at',))
fieldsets = (
fieldsets = (
- (None, {'fields': (('type', 'promo'), 'author', 'author_email', 'image')}),
+ (None, {'fields': (('type', 'promo'), 'author', 'author_email', 'image'
, 'date', 'changed_at'
)}),
) + tuple(
(ln, {'fields': (
('published_%s' % lc),
) + tuple(
(ln, {'fields': (
('published_%s' % lc),
+ 'published_at_%s' % lc,
'title_%s' % lc,
'slug_%s' % lc,
'lead_%s' % lc,
'body_%s' % lc,
)})
'title_%s' % lc,
'slug_%s' % lc,
'lead_%s' % lc,
'body_%s' % lc,
)})
- for lc, ln in settings.OBLIGATORY_LANGUAGES
+ for lc, ln in
app_
settings.OBLIGATORY_LANGUAGES
) + tuple(
(ln, {'fields': (
('needed_%s' % lc, 'published_%s' % lc),
) + tuple(
(ln, {'fields': (
('needed_%s' % lc, 'published_%s' % lc),
+ 'published_at_%s' % lc,
'title_%s' % lc,
'slug_%s' % lc,
'lead_%s' % lc,
'body_%s' % lc,
)})
'title_%s' % lc,
'slug_%s' % lc,
'lead_%s' % lc,
'body_%s' % lc,
)})
- for lc, ln in settings.OPTIONAL_LANGUAGES
+ for lc, ln in
app_
settings.OPTIONAL_LANGUAGES
) + (
(_('Categories'), {'fields': ('categories',)}),
)
) + (
(_('Categories'), {'fields': ('categories',)}),
)
@@
-49,17
+48,17
@@
class EntryAdmin(admin.ModelAdmin):
for lang_code, lang_name in settings.LANGUAGES
])
for lang_code, lang_name in settings.LANGUAGES
])
- list_display = translated_fields(('title',), settings.OBLIGATORY_LANGUAGES
- ) + ('type', 'date', 'author'
+ list_display = translated_fields(('title',),
app_
settings.OBLIGATORY_LANGUAGES
+ ) + ('type', 'date', 'author'
, 'promo'
) + translated_fields(('published',)
) + translated_fields(('published',)
- ) + translated_fields(('needed',), settings.OPTIONAL_LANGUAGES)
- list_filter = ('type',) + translated_fields(('published',)
- ) + translated_fields(('needed',), settings.OPTIONAL_LANGUAGES)
+ ) + translated_fields(('needed',),
app_
settings.OPTIONAL_LANGUAGES)
+ list_filter = ('type',
'promo'
) + translated_fields(('published',)
+ ) + translated_fields(('needed',),
app_
settings.OPTIONAL_LANGUAGES)
inlines = (AttachmentInline,)
class CategoryAdmin(admin.ModelAdmin):
inlines = (AttachmentInline,)
class CategoryAdmin(admin.ModelAdmin):
- list_display = translated_fields(('title', 'slug'))
+ list_display = translated_fields(('title', 'slug'))
+ ('taxonomy',)
prepopulated_fields = dict([
("slug_%s" % lang_code, ("title_%s" % lang_code,))
for lang_code, lang_name in settings.LANGUAGES
prepopulated_fields = dict([
("slug_%s" % lang_code, ("title_%s" % lang_code,))
for lang_code, lang_name in settings.LANGUAGES