From 66b5dfaafedcd67514527ca72fca132563479559 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 10 May 2017 16:18:58 +0200 Subject: [PATCH] option to make publish date editable --- migdal/__init__.py | 2 ++ migdal/admin.py | 5 +++-- setup.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/migdal/__init__.py b/migdal/__init__.py index dda9569..cfe66c7 100644 --- a/migdal/__init__.py +++ b/migdal/__init__.py @@ -47,4 +47,6 @@ class Settings(AppSettings): return tuple(lang for lang in settings.LANGUAGES if lang not in self.OBLIGATORY_LANGUAGES) OPTIONAL_LANGUAGES = None + PUBLISH_DATE_EDITABLE = False + app_settings = Settings('MIGDAL') diff --git a/migdal/admin.py b/migdal/admin.py index f9974be..a03d16c 100644 --- a/migdal/admin.py +++ b/migdal/admin.py @@ -37,8 +37,9 @@ def filtered_entry_admin(typ): return field date_hierarchy = 'date' - readonly_fields = ('date', 'changed_at', 'first_published_at') + \ - translated_fields(('published_at',)) + readonly_fields = ('date', 'changed_at') + translated_fields(('published_at',)) + if app_settings.PUBLISH_DATE_EDITABLE: + readonly_fields += ('first_published_at',) _promo_if_necessary = ('promo',) if typ.promotable else () fieldsets = ( diff --git a/setup.py b/setup.py index db5d4ed..69acd90 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def whole_trees(package_dir, paths): setup( name='django-migdal', - version='0.7.3', + version='0.7.4', author='Radek Czajka', author_email='radoslaw.czajka@nowoczesnapolska.org.pl', maintainer='Jan Szejko', -- 2.20.1