diff --git a/HISTORY.rst b/HISTORY.rst index a552087..ce8eabb 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,13 +7,14 @@ History ++++++++++++++++++++++ * **INCOMPATIBLE CHANGE**: view names changed! -* Synced with latest django-parler development branch +* Based on django parler 1.0 * Toolbar items contextual to the current page * Add support for canonical URLs * Add transifex support * Add social tags via django-meta-mixin * Per-post or site-wide comments enabling * Simpler TextField-based content editing for simpler blogs +* Add support for custom user models 0.1.0 (2014-03-06) diff --git a/cms_helper.py b/cms_helper.py index 143403e..c291462 100644 --- a/cms_helper.py +++ b/cms_helper.py @@ -1,65 +1,78 @@ # -*- coding: utf-8 -*- +import sys from tempfile import mkdtemp gettext = lambda s: s HELPER_SETTINGS = { - 'NOSE_ARGS':[ - '-s', - ], - 'ROOT_URLCONF':'tests.test_utils.urls', - 'INSTALLED_APPS':[ - 'django_nose', - 'filer', - 'parler', - 'taggit', - 'meta', - 'meta_mixin', - 'easy_thumbnails', - 'djangocms_text_ckeditor', - 'cmsplugin_filer_image', - 'django_select2', - 'taggit_autosuggest', - 'djangocms_blog', - ], - 'LANGUAGE_CODE':'en', - 'LANGUAGES':( - ('en', gettext('English')), - ('fr', gettext('French')), - ('it', gettext('Italiano')), - ), - 'CMS_LANGUAGES':{ - 1: [ - { - 'code': 'en', - 'name': gettext('English'), - 'public': True, - }, - { - 'code': 'it', - 'name': gettext('Italiano'), - 'public': True, - }, - { - 'code': 'fr', - 'name': gettext('French'), - 'public': True, - }, - ], - 'default': { - 'hide_untranslated': False, + 'NOSE_ARGS': [ + '-s', + ], + 'ROOT_URLCONF': 'tests.test_utils.urls', + 'INSTALLED_APPS': [ + 'admin_enhancer', + 'filer', + 'parler', + 'taggit', + 'meta', + 'meta_mixin', + 'easy_thumbnails', + 'djangocms_text_ckeditor', + 'cmsplugin_filer_image', + 'django_select2', + 'taggit_autosuggest', + 'djangocms_blog', + ], + 'LANGUAGE_CODE': 'en', + 'LANGUAGES': ( + ('en', gettext('English')), + ('fr', gettext('French')), + ('it', gettext('Italiano')), + ), + 'CMS_LANGUAGES': { + 1: [ + { + 'code': 'en', + 'name': gettext('English'), + 'public': True, }, + { + 'code': 'it', + 'name': gettext('Italiano'), + 'public': True, + }, + { + 'code': 'fr', + 'name': gettext('French'), + 'public': True, + }, + ], + 'default': { + 'hide_untranslated': False, }, - 'META_SITE_PROTOCOL':'http', - 'META_SITE_DOMAIN':'example.com', - 'META_USE_OG_PROPERTIES':True, - 'META_USE_TWITTER_PROPERTIES':True, - 'META_USE_GOOGLEPLUS_PROPERTIES':True, - 'THUMBNAIL_PROCESSORS':( - 'easy_thumbnails.processors.colorspace', - 'easy_thumbnails.processors.autocrop', - 'filer.thumbnail_processors.scale_and_crop_with_subject_location', - 'easy_thumbnails.processors.filters', + }, + 'PARLER_LANGUAGES': { + 1: ( + {'code': 'en'}, + {'code': 'it'}, + {'code': 'fr'}, ), - 'FILE_UPLOAD_TEMP_DIR':mkdtemp() - -} \ No newline at end of file + 'default': { + 'fallback': 'en', + 'hide_untranslated': False, + } + }, + 'META_SITE_PROTOCOL': 'http', + 'META_SITE_DOMAIN': 'example.com', + 'META_USE_OG_PROPERTIES': True, + 'META_USE_TWITTER_PROPERTIES': True, + 'META_USE_GOOGLEPLUS_PROPERTIES': True, + 'THUMBNAIL_PROCESSORS': ( + 'easy_thumbnails.processors.colorspace', + 'easy_thumbnails.processors.autocrop', + 'filer.thumbnail_processors.scale_and_crop_with_subject_location', + 'easy_thumbnails.processors.filters', + ), + 'FILE_UPLOAD_TEMP_DIR': mkdtemp(), +} +if 'test' in sys.argv: + HELPER_SETTINGS['INSTALLED_APPS'].append('django_nose') \ No newline at end of file diff --git a/djangocms_blog/__init__.py b/djangocms_blog/__init__.py index b074002..e75e531 100644 --- a/djangocms_blog/__init__.py +++ b/djangocms_blog/__init__.py @@ -1 +1 @@ -__version__ = '0.2c1' +__version__ = '0.2c2' diff --git a/djangocms_blog/cms_app.py b/djangocms_blog/cms_app.py index c658fc0..f00c96f 100644 --- a/djangocms_blog/cms_app.py +++ b/djangocms_blog/cms_app.py @@ -5,8 +5,8 @@ from django.utils.translation import ugettext_lazy as _ class BlogApp(CMSApp): - name = _("Blog") - urls = ["djangocms_blog.urls"] + name = _('Blog') + urls = ['djangocms_blog.urls'] app_name = 'djangocms_blog' apphook_pool.register(BlogApp) diff --git a/djangocms_blog/cms_toolbar.py b/djangocms_blog/cms_toolbar.py index eae4a36..3e81a35 100644 --- a/djangocms_blog/cms_toolbar.py +++ b/djangocms_blog/cms_toolbar.py @@ -15,7 +15,7 @@ class BlogToolbar(CMSToolbar): # TODO: Readd if not self.is_current_app condition when CMS 3.0.4 is released if not self.request.user.has_perm('djangocms_blog.add_post'): return # pragma: no cover - admin_menu = self.toolbar.get_or_create_menu("djangocms_blog", _('Blog')) + admin_menu = self.toolbar.get_or_create_menu('djangocms_blog', _('Blog')) url = reverse('admin:djangocms_blog_post_changelist') admin_menu.add_modal_item(_('Post list'), url=url) url = reverse('admin:djangocms_blog_post_add') diff --git a/djangocms_blog/forms.py b/djangocms_blog/forms.py index 3a760d0..6d8310a 100644 --- a/djangocms_blog/forms.py +++ b/djangocms_blog/forms.py @@ -14,5 +14,5 @@ class LatestEntriesForm(forms.ModelForm): class Media: css = { 'all': ('%sdjangocms_blog/css/%s' % (settings.STATIC_URL, - "djangocms_blog_admin.css"),) + 'djangocms_blog_admin.css'),) } diff --git a/djangocms_blog/locale/ar/LC_MESSAGES/django.mo b/djangocms_blog/locale/ar/LC_MESSAGES/django.mo new file mode 100644 index 0000000..b37d139 Binary files /dev/null and b/djangocms_blog/locale/ar/LC_MESSAGES/django.mo differ diff --git a/djangocms_blog/locale/ar/LC_MESSAGES/django.po b/djangocms_blog/locale/ar/LC_MESSAGES/django.po new file mode 100644 index 0000000..0acf53e --- /dev/null +++ b/djangocms_blog/locale/ar/LC_MESSAGES/django.po @@ -0,0 +1,260 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: djangocms-blog\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-09-01 07:16+0200\n" +"PO-Revision-Date: 2014-03-29 15:29+0000\n" +"Last-Translator: Iacopo Spalletti\n" +"Language-Team: Arabic (http://www.transifex.com/projects/p/djangocms-blog/language/ar/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ar\n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" +"X-Generator: Lokalize 1.5\n" + +#: cms_app.py:8 cms_plugins.py:32 cms_plugins.py:45 cms_plugins.py:56 +#: cms_plugins.py:67 cms_toolbar.py:18 +msgid "Blog" +msgstr "" + +#: cms_plugins.py:20 +msgid "Latest Blog Articles" +msgstr "" + +#: cms_plugins.py:33 +msgid "Author Blog Articles" +msgstr "" + +#: cms_plugins.py:46 templates/djangocms_blog/plugins/tags.html:4 +msgid "Tags" +msgstr "" + +#: cms_plugins.py:57 templates/djangocms_blog/plugins/categories.html:4 +msgid "Categories" +msgstr "" + +#: cms_plugins.py:68 templates/djangocms_blog/post_list.html:12 +#: templates/djangocms_blog/plugins/archive.html:4 +msgid "Archive" +msgstr "" + +#: cms_toolbar.py:20 +msgid "Post list" +msgstr "" + +#: cms_toolbar.py:22 +msgid "Add post" +msgstr "" + +#: cms_toolbar.py:26 +msgid "Edit Post" +msgstr "" + +#: feeds.py:16 +#, python-format +msgid "Blog articles on %(site_name)s" +msgstr "" + +#: models.py:28 +msgid "parent" +msgstr "" + +#: models.py:30 +msgid "created at" +msgstr "" + +#: models.py:31 +msgid "modified at" +msgstr "" + +#: models.py:34 +msgid "name" +msgstr "" + +#: models.py:35 models.py:95 +msgid "slug" +msgstr "" + +#: models.py:42 +msgid "blog category" +msgstr "" + +#: models.py:43 +msgid "blog categories" +msgstr "" + +#: models.py:66 +msgid "Author" +msgstr "" + +#: models.py:71 +msgid "Published Since" +msgstr "" + +#: models.py:73 +msgid "Published Until" +msgstr "" + +#: models.py:75 +msgid "Publish" +msgstr "" + +#: models.py:76 +msgid "category" +msgstr "" + +#: models.py:78 +msgid "Main image" +msgstr "" + +#: models.py:81 +msgid "Main image thumbnail" +msgstr "" + +#: models.py:85 +msgid "Main image full" +msgstr "" + +#: models.py:89 +msgid "Enable comments on post" +msgstr "" + +#: models.py:94 +msgid "Title" +msgstr "" + +#: models.py:96 +msgid "Abstract" +msgstr "" + +#: models.py:97 +msgid "Post meta description" +msgstr "" + +#: models.py:99 +msgid "Post meta keywords" +msgstr "" + +#: models.py:101 +msgid "Text" +msgstr "" + +#: models.py:158 +msgid "blog article" +msgstr "" + +#: models.py:159 +msgid "blog articles" +msgstr "" + +#: models.py:199 models.py:226 +msgid "Articles" +msgstr "" + +#: models.py:200 +msgid "The number of latests articles to be displayed." +msgstr "" + +#: models.py:202 +msgid "Show only the blog articles tagged with chosen tags." +msgstr "" + +#: models.py:204 +msgid "Show only the blog articles tagged with chosen categories." +msgstr "" + +#: models.py:222 templates/djangocms_blog/plugins/authors.html:3 +msgid "Authors" +msgstr "" + +#: models.py:227 +msgid "The number of author articles to be displayed." +msgstr "" + +#: templates/djangocms_blog/post_detail.html:16 +#: templates/djangocms_blog/includes/blog_item.html:10 +msgid "by" +msgstr "" + +#: templates/djangocms_blog/post_list.html:11 +msgid "Articles by" +msgstr "" + +#: templates/djangocms_blog/post_list.html:13 +msgid "Tag" +msgstr "" + +#: templates/djangocms_blog/post_list.html:14 +msgid "Category" +msgstr "" + +#: templates/djangocms_blog/post_list.html:21 +#: templates/djangocms_blog/plugins/archive.html:27 +#: templates/djangocms_blog/plugins/authors.html:15 +#: templates/djangocms_blog/plugins/categories.html:16 +#: templates/djangocms_blog/plugins/latest_entries.html:7 +#: templates/djangocms_blog/plugins/tags.html:16 +msgid "No article found." +msgstr "" + +#: templates/djangocms_blog/post_list.html:24 +msgid "Back" +msgstr "" + +#: templates/djangocms_blog/post_list.html:30 +msgid "previous" +msgstr "" + +#: templates/djangocms_blog/post_list.html:33 +msgid "Page" +msgstr "" + +#: templates/djangocms_blog/post_list.html:33 +msgid "of" +msgstr "" + +#: templates/djangocms_blog/post_list.html:36 +msgid "next" +msgstr "" + +#: templates/djangocms_blog/includes/blog_item.html:44 +msgid "read more" +msgstr "" + +#: templates/djangocms_blog/plugins/archive.html:18 +#: templates/djangocms_blog/plugins/authors.html:10 +#: templates/djangocms_blog/plugins/categories.html:11 +#: templates/djangocms_blog/plugins/tags.html:11 +#, python-format +msgid "1 article" +msgid_plural "%(articles)s articles" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" +msgstr[3] "" +msgstr[4] "" +msgstr[5] "" + +#: templates/djangocms_blog/plugins/archive.html:19 +#: templates/djangocms_blog/plugins/authors.html:11 +#: templates/djangocms_blog/plugins/categories.html:12 +#: templates/djangocms_blog/plugins/tags.html:12 +msgid "0 articles" +msgstr "" + +#~ msgid "blog post" +#~ msgstr "blog post" + +#~ msgid "Posts" +#~ msgstr "Posts" + +#~ msgid "Entries by" +#~ msgstr "Entries by" + +#~ msgid "No entry found." +#~ msgstr "No entry found." diff --git a/djangocms_blog/locale/en/LC_MESSAGES/django.mo b/djangocms_blog/locale/en/LC_MESSAGES/django.mo index 07df55b..16fc5c0 100644 Binary files a/djangocms_blog/locale/en/LC_MESSAGES/django.mo and b/djangocms_blog/locale/en/LC_MESSAGES/django.mo differ diff --git a/djangocms_blog/locale/en/LC_MESSAGES/django.po b/djangocms_blog/locale/en/LC_MESSAGES/django.po index ae0bd3e..6fcb549 100644 --- a/djangocms_blog/locale/en/LC_MESSAGES/django.po +++ b/djangocms_blog/locale/en/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-06-11 13:11+0200\n" +"POT-Creation-Date: 2014-09-01 07:16+0200\n" "PO-Revision-Date: 2014-03-05 18:09+0100\n" "Last-Translator: Iacopo Spalletti\n" "Language-Team: Italian \n" @@ -18,7 +18,7 @@ msgstr "" "X-Generator: Lokalize 1.5\n" #: cms_app.py:8 cms_plugins.py:32 cms_plugins.py:45 cms_plugins.py:56 -#: cms_plugins.py:67 cms_toolbar.py:17 +#: cms_plugins.py:67 cms_toolbar.py:18 msgid "Blog" msgstr "Blog" @@ -43,15 +43,15 @@ msgstr "Categories" msgid "Archive" msgstr "Archive" -#: cms_toolbar.py:19 +#: cms_toolbar.py:20 msgid "Post list" msgstr "Post list" -#: cms_toolbar.py:21 +#: cms_toolbar.py:22 msgid "Add post" msgstr "Add post" -#: cms_toolbar.py:25 +#: cms_toolbar.py:26 msgid "Edit Post" msgstr "" @@ -60,31 +60,31 @@ msgstr "" msgid "Blog articles on %(site_name)s" msgstr "Blog articles on %(site_name)s" -#: models.py:29 +#: models.py:28 msgid "parent" msgstr "parent" -#: models.py:31 +#: models.py:30 msgid "created at" msgstr "created at" -#: models.py:32 +#: models.py:31 msgid "modified at" msgstr "modified at" -#: models.py:35 +#: models.py:34 msgid "name" msgstr "name" -#: models.py:36 models.py:95 +#: models.py:35 models.py:95 msgid "slug" msgstr "slug" -#: models.py:43 +#: models.py:42 msgid "blog category" msgstr "blog category" -#: models.py:44 +#: models.py:43 msgid "blog categories" msgstr "blog categories" @@ -145,31 +145,31 @@ msgstr "Post meta description" msgid "Text" msgstr "Text" -#: models.py:156 +#: models.py:158 msgid "blog article" msgstr "blog article" -#: models.py:157 +#: models.py:159 msgid "blog articles" msgstr "blog articles" -#: models.py:201 models.py:226 +#: models.py:199 models.py:226 msgid "Articles" msgstr "Articles" -#: models.py:202 +#: models.py:200 msgid "The number of latests articles to be displayed." msgstr "The number of latests articles to be displayed." -#: models.py:204 +#: models.py:202 msgid "Show only the blog articles tagged with chosen tags." msgstr "Show only the blog articles tagged with chosen tags." -#: models.py:206 +#: models.py:204 msgid "Show only the blog articles tagged with chosen categories." msgstr "Show only the blog articles tagged with chosen categories." -#: models.py:223 templates/djangocms_blog/plugins/authors.html:3 +#: models.py:222 templates/djangocms_blog/plugins/authors.html:3 msgid "Authors" msgstr "Authors" diff --git a/djangocms_blog/locale/it/LC_MESSAGES/django.mo b/djangocms_blog/locale/it/LC_MESSAGES/django.mo index 4585fc8..8e8faef 100644 Binary files a/djangocms_blog/locale/it/LC_MESSAGES/django.mo and b/djangocms_blog/locale/it/LC_MESSAGES/django.mo differ diff --git a/djangocms_blog/managers.py b/djangocms_blog/managers.py index 4d9a891..0e9fd70 100644 --- a/djangocms_blog/managers.py +++ b/djangocms_blog/managers.py @@ -48,7 +48,7 @@ class TaggedFilterItem(object): def tag_list_slug(self, other_model=None, queryset=None): queryset = self.tag_list(other_model, queryset) - return queryset.values("slug") + return queryset.values('slug') def tag_cloud(self, other_model=None, queryset=None, published=True): from taggit.models import TaggedItem @@ -70,9 +70,9 @@ class TaggedFilterItem(object): class GenericDateTaggedManager(TaggedFilterItem, TranslationManager): use_for_related_fields = True - start_date_field = "date_published" - end_date_field = "date_published_end" - publish_field = "publish" + start_date_field = 'date_published' + end_date_field = 'date_published_end' + publish_field = 'publish' def get_queryset(self, *args, **kwargs): try: @@ -84,7 +84,7 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager): queryset = self.published_future(queryset) if self.start_date_field: return queryset.filter( - **{"%s__lte" % self.start_date_field: now()}) + **{'%s__lte' % self.start_date_field: now()}) else: return queryset @@ -93,8 +93,8 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager): queryset = self.get_queryset().all() if self.end_date_field: qfilter = ( - models.Q(**{"%s__gte" % self.end_date_field: now()}) - | models.Q(**{"%s__isnull" % self.end_date_field: True}) + models.Q(**{'%s__gte' % self.end_date_field: now()}) + | models.Q(**{'%s__isnull' % self.end_date_field: True}) ) queryset = queryset.filter(qfilter) return queryset.filter(**{self.publish_field: True}) @@ -104,8 +104,8 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager): queryset = self.get_queryset().all() if self.end_date_field: qfilter = ( - models.Q(**{"%s__lte" % self.end_date_field: now()}) - | models.Q(**{"%s__isnull" % self.end_date_field: False}) + models.Q(**{'%s__lte' % self.end_date_field: now()}) + | models.Q(**{'%s__isnull' % self.end_date_field: False}) ) queryset = queryset.filter(qfilter) return queryset.filter(**{self.publish_field: True}) @@ -119,7 +119,9 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager): return self.get_queryset().active_translations(language_code=language) def get_months(self, queryset=None): - """Get months with aggregate count (how much posts is in the month). Results are ordered by date.""" + """ + Get months with aggregate count (how much posts is in the month). Results are ordered by date. + """ if queryset is None: queryset = self.get_queryset() dates = queryset.values_list(self.start_date_field, flat=True) diff --git a/djangocms_blog/migrations/0001_initial.py b/djangocms_blog/migrations/0001_initial.py index 14a6b9a..b3087dc 100644 --- a/djangocms_blog/migrations/0001_initial.py +++ b/djangocms_blog/migrations/0001_initial.py @@ -1,10 +1,16 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime +from django.contrib.auth import get_user_model +from django.utils import timezone from south.db import db from south.v2 import SchemaMigration from django.db import models +User = get_user_model() +user_orm_label = '%s.%s' % (User._meta.app_label, User._meta.object_name) +user_model_label = '%s.%s' % (User._meta.app_label, User._meta.module_name) + + class Migration(SchemaMigration): def forwards(self, orm): @@ -53,10 +59,10 @@ class Migration(SchemaMigration): # Adding model 'Post' db.create_table(u'djangocms_blog_post', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm[user_orm_label])), ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - ('date_published', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('date_published', self.gf('django.db.models.fields.DateTimeField')(default=timezone.now)), ('date_published_end', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), ('publish', self.gf('django.db.models.fields.BooleanField')(default=False)), ('main_image', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['filer.Image'], null=True, blank=True)), @@ -112,7 +118,7 @@ class Migration(SchemaMigration): db.create_table(m2m_table_name, ( ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), ('authorentriesplugin', models.ForeignKey(orm[u'djangocms_blog.authorentriesplugin'], null=False)), - ('user', models.ForeignKey(orm[u'auth.user'], null=False)) + ('user', models.ForeignKey(orm[user_orm_label], null=False)) )) db.create_unique(m2m_table_name, ['authorentriesplugin_id', 'user_id']) @@ -175,8 +181,8 @@ class Migration(SchemaMigration): u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, - u'auth.user': { - 'Meta': {'object_name': 'User'}, + user_model_label: { + 'Meta': {'object_name': User.__name__, 'db_table': "'%s'" % User._meta.db_table}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), @@ -230,7 +236,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.authorentriesplugin': { 'Meta': {'object_name': 'AuthorEntriesPlugin', 'db_table': "u'cmsplugin_authorentriesplugin'", '_ormbases': ['cms.CMSPlugin']}, - 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['%s']" % user_orm_label, 'symmetrical': 'False'}), u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), 'latest_posts': ('django.db.models.fields.IntegerField', [], {'default': '5'}) }, @@ -258,7 +264,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.post': { 'Meta': {'ordering': "('-date_published', '-date_created')", 'object_name': 'Post'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['%s']" % user_orm_label}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'blog_posts'", 'symmetrical': 'False', 'to': u"orm['djangocms_blog.BlogCategory']"}), 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), @@ -292,7 +298,7 @@ class Migration(SchemaMigration): 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['%s']" % user_orm_label}), 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'polymorphic_filer.file_set'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'sha1': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40', 'blank': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) @@ -305,7 +311,7 @@ class Migration(SchemaMigration): u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['%s']" % user_orm_label}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}), u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), diff --git a/djangocms_blog/migrations/0002_auto__del_blogcategorytranslation__del_unique_blogcategorytranslation_.py b/djangocms_blog/migrations/0002_auto__del_blogcategorytranslation__del_unique_blogcategorytranslation_.py index 2a3bf30..0f6a554 100644 --- a/djangocms_blog/migrations/0002_auto__del_blogcategorytranslation__del_unique_blogcategorytranslation_.py +++ b/djangocms_blog/migrations/0002_auto__del_blogcategorytranslation__del_unique_blogcategorytranslation_.py @@ -1,22 +1,21 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime +from django.conf import settings as dj_settings from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Post.author' - db.alter_column(u'djangocms_blog_post', 'author_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)) + db.alter_column(u'djangocms_blog_post', 'author_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm[dj_settings.AUTH_USER_MODEL], null=True)) def backwards(self, orm): raise RuntimeError("Cannot reverse this migration. 'Post.author' and its values cannot be restored.") # The following code is provided here to aid in writing a correct migration # Changing field 'Post.author' - db.alter_column(u'djangocms_blog_post', 'author_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])) + db.alter_column(u'djangocms_blog_post', 'author_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm[dj_settings.AUTH_USER_MODEL])) models = { u'auth.group': { @@ -87,7 +86,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.authorentriesplugin': { 'Meta': {'object_name': 'AuthorEntriesPlugin', 'db_table': "u'cmsplugin_authorentriesplugin'", '_ormbases': ['cms.CMSPlugin']}, - 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'symmetrical': 'False'}), u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), 'latest_posts': ('django.db.models.fields.IntegerField', [], {'default': '5'}) }, @@ -115,7 +114,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.post': { 'Meta': {'ordering': "('-date_published', '-date_created')", 'object_name': 'Post'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'null': 'True', 'blank': 'True'}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'blog_posts'", 'symmetrical': 'False', 'to': u"orm['djangocms_blog.BlogCategory']"}), 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), @@ -149,7 +148,7 @@ class Migration(SchemaMigration): 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'polymorphic_filer.file_set'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'sha1': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40', 'blank': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) @@ -162,7 +161,7 @@ class Migration(SchemaMigration): u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}), u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), diff --git a/djangocms_blog/migrations/0003_rename_plugins.py b/djangocms_blog/migrations/0003_rename_plugins.py index cc2e53e..2c62b0d 100644 --- a/djangocms_blog/migrations/0003_rename_plugins.py +++ b/djangocms_blog/migrations/0003_rename_plugins.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime +from django.conf import settings as dj_settings from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): - db.rename_table(u'cmsplugin_latestpostsplugin', u'djangocms_blog_latestpostsplugin') - db.rename_table(u'cmsplugin_authorentriesplugin', u'djangocms_blog_authorentriesplugin') + db.rename_table(u'cmsplugin_latestpostsplugin', u'djangocms_blog_latestpostsplugin') + db.rename_table(u'cmsplugin_authorentriesplugin', u'djangocms_blog_authorentriesplugin') def backwards(self, orm): - db.rename_table(u'djangocms_blog_latestpostsplugin', u'cmsplugin_latestpostsplugin') - db.rename_table(u'djangocms_blog_authorentriesplugin', u'cmsplugin_authorentriesplugin') + db.rename_table(u'djangocms_blog_latestpostsplugin', u'cmsplugin_latestpostsplugin') + db.rename_table(u'djangocms_blog_authorentriesplugin', u'cmsplugin_authorentriesplugin') models = { @@ -86,7 +85,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.authorentriesplugin': { 'Meta': {'object_name': 'AuthorEntriesPlugin', '_ormbases': ['cms.CMSPlugin']}, - 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'symmetrical': 'False'}), u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), 'latest_posts': ('django.db.models.fields.IntegerField', [], {'default': '5'}) }, @@ -114,7 +113,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.post': { 'Meta': {'ordering': "('-date_published', '-date_created')", 'object_name': 'Post'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'null': 'True', 'blank': 'True'}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'blog_posts'", 'symmetrical': 'False', 'to': u"orm['djangocms_blog.BlogCategory']"}), 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), @@ -148,7 +147,7 @@ class Migration(SchemaMigration): 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'polymorphic_filer.file_set'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'sha1': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40', 'blank': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) @@ -161,7 +160,7 @@ class Migration(SchemaMigration): u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}), u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), diff --git a/djangocms_blog/migrations/0004_auto__add_field_posttranslation_meta_description.py b/djangocms_blog/migrations/0004_auto__add_field_posttranslation_meta_description.py index 73e37b5..81518b1 100644 --- a/djangocms_blog/migrations/0004_auto__add_field_posttranslation_meta_description.py +++ b/djangocms_blog/migrations/0004_auto__add_field_posttranslation_meta_description.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime +from django.conf import settings as dj_settings from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): @@ -88,7 +87,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.authorentriesplugin': { 'Meta': {'object_name': 'AuthorEntriesPlugin', '_ormbases': ['cms.CMSPlugin']}, - 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'symmetrical': 'False'}), u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), 'latest_posts': ('django.db.models.fields.IntegerField', [], {'default': '5'}) }, @@ -116,7 +115,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.post': { 'Meta': {'ordering': "('-date_published', '-date_created')", 'object_name': 'Post'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'null': 'True', 'blank': 'True'}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'blog_posts'", 'symmetrical': 'False', 'to': u"orm['djangocms_blog.BlogCategory']"}), 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), @@ -151,7 +150,7 @@ class Migration(SchemaMigration): 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'polymorphic_filer.file_set'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'sha1': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40', 'blank': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) @@ -164,7 +163,7 @@ class Migration(SchemaMigration): u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}), u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), diff --git a/djangocms_blog/migrations/0005_auto__add_field_posttranslation_meta_keywords.py b/djangocms_blog/migrations/0005_auto__add_field_posttranslation_meta_keywords.py index c5b538b..5af45bf 100644 --- a/djangocms_blog/migrations/0005_auto__add_field_posttranslation_meta_keywords.py +++ b/djangocms_blog/migrations/0005_auto__add_field_posttranslation_meta_keywords.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime +from django.conf import settings as dj_settings from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): @@ -88,7 +87,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.authorentriesplugin': { 'Meta': {'object_name': 'AuthorEntriesPlugin', '_ormbases': ['cms.CMSPlugin']}, - 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'symmetrical': 'False'}), u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), 'latest_posts': ('django.db.models.fields.IntegerField', [], {'default': '5'}) }, @@ -116,7 +115,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.post': { 'Meta': {'ordering': "('-date_published', '-date_created')", 'object_name': 'Post'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'null': 'True', 'blank': 'True'}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'blog_posts'", 'symmetrical': 'False', 'to': u"orm['djangocms_blog.BlogCategory']"}), 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), @@ -152,7 +151,7 @@ class Migration(SchemaMigration): 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'polymorphic_filer.file_set'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'sha1': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40', 'blank': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) @@ -165,7 +164,7 @@ class Migration(SchemaMigration): u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}), u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), diff --git a/djangocms_blog/migrations/0006_auto__add_field_post_enable_comments.py b/djangocms_blog/migrations/0006_auto__add_field_post_enable_comments.py index d31b001..228f717 100644 --- a/djangocms_blog/migrations/0006_auto__add_field_post_enable_comments.py +++ b/djangocms_blog/migrations/0006_auto__add_field_post_enable_comments.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime +from django.conf import settings as dj_settings from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): @@ -88,7 +87,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.authorentriesplugin': { 'Meta': {'object_name': 'AuthorEntriesPlugin', '_ormbases': ['cms.CMSPlugin']}, - 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'symmetrical': 'False'}), u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), 'latest_posts': ('django.db.models.fields.IntegerField', [], {'default': '5'}) }, @@ -116,7 +115,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.post': { 'Meta': {'ordering': "('-date_published', '-date_created')", 'object_name': 'Post'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'djangocms_blog_post_author'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'djangocms_blog_post_author'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'blog_posts'", 'symmetrical': 'False', 'to': u"orm['djangocms_blog.BlogCategory']"}), 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), @@ -153,7 +152,7 @@ class Migration(SchemaMigration): 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'owned_files'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'owned_files'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'polymorphic_filer.file_set'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'sha1': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '40', 'blank': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) @@ -166,7 +165,7 @@ class Migration(SchemaMigration): u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'filer_owned_folders'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'filer_owned_folders'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'children'", 'null': 'True', 'to': u"orm['filer.Folder']"}), u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), diff --git a/djangocms_blog/migrations/0007_auto__add_field_posttranslation_post_text.py b/djangocms_blog/migrations/0007_auto__add_field_posttranslation_post_text.py index 6979048..f1da468 100644 --- a/djangocms_blog/migrations/0007_auto__add_field_posttranslation_post_text.py +++ b/djangocms_blog/migrations/0007_auto__add_field_posttranslation_post_text.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime +from django.conf import settings as dj_settings from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): @@ -88,7 +87,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.authorentriesplugin': { 'Meta': {'object_name': 'AuthorEntriesPlugin', '_ormbases': ['cms.CMSPlugin']}, - 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}), + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL, 'symmetrical': 'False'}), u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), 'latest_posts': ('django.db.models.fields.IntegerField', [], {'default': '5'}) }, @@ -116,7 +115,7 @@ class Migration(SchemaMigration): }, u'djangocms_blog.post': { 'Meta': {'ordering': "('-date_published', '-date_created')", 'object_name': 'Post'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'djangocms_blog_post_author'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'author': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'djangocms_blog_post_author'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'blog_posts'", 'symmetrical': 'False', 'to': u"orm['djangocms_blog.BlogCategory']"}), 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), @@ -154,7 +153,7 @@ class Migration(SchemaMigration): 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'owned_files'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'owned_files'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'polymorphic_filer.file_set'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'sha1': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '40', 'blank': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) @@ -167,7 +166,7 @@ class Migration(SchemaMigration): u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'filer_owned_folders'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'filer_owned_folders'", 'null': 'True', 'to': u"orm['%s']" % dj_settings.AUTH_USER_MODEL}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'children'", 'null': 'True', 'to': u"orm['filer.Folder']"}), u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index f052c45..2311ac5 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from cms.models import PlaceholderField, CMSPlugin from cmsplugin_filer_image.models import ThumbnailOption -from django.contrib.auth.models import User +from django.conf import settings as dj_settings from django.core.urlresolvers import reverse from django.db import models from django.utils import timezone @@ -62,7 +62,8 @@ class Post(ModelMeta, TranslatableModel): """ Blog post """ - author = models.ForeignKey(User, verbose_name=_('Author'), null=True, blank=True, + author = models.ForeignKey(dj_settings.AUTH_USER_MODEL, + verbose_name=_('Author'), null=True, blank=True, related_name='djangocms_blog_post_author') date_created = models.DateTimeField(auto_now_add=True) @@ -100,7 +101,7 @@ class Post(ModelMeta, TranslatableModel): post_text=HTMLField(_('Text'), default='', blank=True), meta={'unique_together': (('language_code', 'slug'),)} ) - content = PlaceholderField("post_content") + content = PlaceholderField('post_content') objects = GenericDateTaggedManager() tags = TaggableManager(blank=True, related_name='djangocms_blog_tags') @@ -133,7 +134,7 @@ class Post(ModelMeta, TranslatableModel): } def get_keywords(self): - return self.safe_translation_getter('meta_keywords').strip().split(",") + return self.safe_translation_getter('meta_keywords').strip().split(',') def get_description(self): description = self.safe_translation_getter('meta_description', any_language=True) @@ -148,7 +149,7 @@ class Post(ModelMeta, TranslatableModel): def get_tags(self): taglist = [tag.name for tag in self.tags.all()] - return ",".join(taglist) + return ','.join(taglist) def get_author(self): return self.author @@ -156,7 +157,7 @@ class Post(ModelMeta, TranslatableModel): class Meta: verbose_name = _('blog article') verbose_name_plural = _('blog articles') - ordering = ("-date_published", "-date_created") + ordering = ('-date_published', '-date_created') get_latest_by = 'date_published' def __unicode__(self): @@ -203,7 +204,7 @@ class LatestPostsPlugin(CMSPlugin): help_text=_('Show only the blog articles tagged with chosen categories.')) def __unicode__(self): - return u"%s latest articles by tag" % self.latest_posts + return u'%s latest articles by tag' % self.latest_posts def copy_relations(self, oldinstance): self.tags = oldinstance.tags.all() @@ -217,14 +218,17 @@ class LatestPostsPlugin(CMSPlugin): class AuthorEntriesPlugin(CMSPlugin): - authors = models.ManyToManyField(User, verbose_name=_('Authors'), - limit_choices_to={'djangocms_blog_post_author__publish': True} - ) - latest_posts = models.IntegerField(_(u'Articles'), default=settings.BLOG_LATEST_POSTS, - help_text=_('The number of author articles to be displayed.')) + authors = models.ManyToManyField( + dj_settings.AUTH_USER_MODEL, verbose_name=_('Authors'), + limit_choices_to={'djangocms_blog_post_author__publish': True} + ) + latest_posts = models.IntegerField( + _(u'Articles'), default=settings.BLOG_LATEST_POSTS, + help_text=_('The number of author articles to be displayed.') + ) def __unicode__(self): - return u"%s latest articles by author" % self.latest_posts + return u'%s latest articles by author' % self.latest_posts def copy_relations(self, oldinstance): self.authors = oldinstance.authors.all() diff --git a/djangocms_blog/templates/djangocms_blog/includes/blog_item.html b/djangocms_blog/templates/djangocms_blog/includes/blog_item.html index f7884d0..f5c2022 100644 --- a/djangocms_blog/templates/djangocms_blog/includes/blog_item.html +++ b/djangocms_blog/templates/djangocms_blog/includes/blog_item.html @@ -7,7 +7,7 @@ {% block blog_meta %}