From: Jan Szejko Date: Wed, 10 May 2017 14:18:58 +0000 (+0200) Subject: option to make publish date editable X-Git-Tag: 0.7.4 X-Git-Url: https://git.mdrn.pl/django-migdal.git/commitdiff_plain/refs/tags/0.7.4 option to make publish date editable --- 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',