diff --git a/newsbox/__init__.py b/newsbox/__init__.py index 804709a8084bcf0174ab6ed7e1ddd321e1c05543..855b6f721198c07136def7b6e20d14e4e59f81b3 100644 --- a/newsbox/__init__.py +++ b/newsbox/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -__version__ = '0.6.9' +__version__ = '0.6.10' diff --git a/newsbox/admin.py b/newsbox/admin.py index 870b22d2e5287bab97dd7db1130de509ec68f25a..6de7a19855e4b4f8864742ed0b9ba2be60850aa0 100644 --- a/newsbox/admin.py +++ b/newsbox/admin.py @@ -198,7 +198,7 @@ class NewsboxBaseAdmin(admin.ModelAdmin): obj.save() log_msg = _('publication status changed from %(old)s to %(new)s') % { 'old': old_status, - 'new_status': obj.newsbox_status, + 'new': obj.newsbox_status, } if obj.newsbox_status == obj.STATUS_PUBLISHED: msg = _('The %(objtype)s "%(objtitle)s" has been successfully published') diff --git a/newsbox/models.py b/newsbox/models.py index 132000a34f1cac18f8dbbb7823a1a6845083595f..9ff9822400e42cfd0e3364ad8beb76c26b3950ef 100644 --- a/newsbox/models.py +++ b/newsbox/models.py @@ -1,18 +1,21 @@ # -*- coding: utf-8 -*- +# "Future imports" from __future__ import unicode_literals +# "Standard libs" import sys -from datetime import datetime +from warnings import warn +# "Django imports" from django.core.urlresolvers import reverse from django.db import models -from django.utils.timezone import now -from django.utils.translation import ugettext_lazy as _ -from django.utils.encoding import python_2_unicode_compatible from django.utils import six +from django.utils.encoding import python_2_unicode_compatible from django.utils.functional import lazy from django.utils.safestring import mark_safe +from django.utils.timezone import now +from django.utils.translation import ugettext_lazy as _ mark_safe_lazy = lazy(mark_safe, six.text_type) newsbox_models = [] @@ -292,6 +295,20 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)): def __str__(self): return six.text_type(self.newsbox_title) + @property + def newsbox_published(self): + warn(('newsbox_published field is deprecated in favor of newsbox_status. ' + 'Please upgrade your code.'), + DeprecationWarning) + return self.is_published + + @newsbox_published.setter + def newsbox_published(self, val): + warn(('newsbox_published field is deprecated in favor of newsbox_status. ' + 'Please upgrade your code.'), + DeprecationWarning) + self.newsbox_status = self.STATUS_PUBLISHED + @property def is_published(self): if self.newsbox_status != self.STATUS_PUBLISHED: