Merge branch 'develop' into feature/handle_blog_category_not_found

This commit is contained in:
PCoder 2017-12-31 19:45:05 +01:00
commit ca605e516b
7 changed files with 93 additions and 179 deletions

View file

@ -17,7 +17,6 @@ from django.http import HttpResponseRedirect
from django.utils import timezone from django.utils import timezone
from django.utils.six import callable, text_type from django.utils.six import callable, text_type
from django.utils.translation import get_language_from_request, ugettext_lazy as _, ungettext as __ from django.utils.translation import get_language_from_request, ugettext_lazy as _, ungettext as __
from parler.admin import TranslatableAdmin from parler.admin import TranslatableAdmin
from .cms_appconfig import BlogConfig from .cms_appconfig import BlogConfig

View file

@ -12,7 +12,9 @@ from menus.menu_pool import menu_pool
from .cms_appconfig import BlogConfig from .cms_appconfig import BlogConfig
from .models import BlogCategory, Post from .models import BlogCategory, Post
from .settings import MENU_TYPE_CATEGORIES, MENU_TYPE_COMPLETE, MENU_TYPE_POSTS, get_setting from .settings import (
MENU_TYPE_CATEGORIES, MENU_TYPE_COMPLETE, MENU_TYPE_NONE, MENU_TYPE_POSTS, get_setting,
)
class BlogCategoryMenu(CMSAttachMenu): class BlogCategoryMenu(CMSAttachMenu):
@ -59,6 +61,8 @@ class BlogCategoryMenu(CMSAttachMenu):
categories_menu = True categories_menu = True
if config and config.menu_structure in (MENU_TYPE_COMPLETE, MENU_TYPE_POSTS): if config and config.menu_structure in (MENU_TYPE_COMPLETE, MENU_TYPE_POSTS):
posts_menu = True posts_menu = True
if config and config.menu_structure in (MENU_TYPE_NONE, ):
return nodes
used_categories = [] used_categories = []
if posts_menu: if posts_menu:

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-04 16:35+0100\n" "POT-Creation-Date: 2017-12-31 12:35+0100\n"
"PO-Revision-Date: 2014-03-05 18:09+0100\n" "PO-Revision-Date: 2014-03-05 18:09+0100\n"
"Last-Translator: Iacopo Spalletti\n" "Last-Translator: Iacopo Spalletti\n"
"Language-Team: Italian <i.spalletti@nephila.it>\n" "Language-Team: Italian <i.spalletti@nephila.it>\n"
@ -19,43 +19,67 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Lokalize 1.5\n" "X-Generator: Lokalize 1.5\n"
#: admin.py:34 #: admin.py:35
msgid "site" msgid "site"
msgstr "" msgstr ""
#: admin.py:91 #: admin.py:103
msgid "Info" msgid "Info"
msgstr "" msgstr ""
#: admin.py:97 #: admin.py:109
msgid "Images" msgid "Images"
msgstr "" msgstr ""
#: admin.py:101 #: admin.py:113
msgid "SEO" msgid "SEO"
msgstr "" msgstr ""
#: admin.py:305 #: admin.py:206
msgid "Publish selection"
msgstr ""
#: admin.py:207
msgid "Unpublish selection"
msgstr ""
#: admin.py:208
msgid "Enable comments for selection"
msgstr ""
#: admin.py:209
msgid "Disable comments for selection "
msgstr ""
#: admin.py:210
msgid "Enable liveblog for selection"
msgstr ""
#: admin.py:211
msgid "Disable liveblog for selection "
msgstr ""
#: admin.py:405
msgid "Generic" msgid "Generic"
msgstr "" msgstr ""
#: admin.py:311 #: admin.py:411
msgid "Layout" msgid "Layout"
msgstr "" msgstr ""
#: admin.py:318 #: admin.py:418
msgid "Notifications" msgid "Notifications"
msgstr "" msgstr ""
#: admin.py:324 #: admin.py:424
msgid "Sitemap" msgid "Sitemap"
msgstr "" msgstr ""
#: admin.py:330 #: admin.py:430
msgid "Meta" msgid "Meta"
msgstr "" msgstr ""
#: admin.py:341 admin.py:349 admin.py:357 #: admin.py:441 admin.py:449 admin.py:457
msgid "You can provide plain strings, Post model attribute or method names" msgid "You can provide plain strings, Post model attribute or method names"
msgstr "" msgstr ""
@ -287,7 +311,7 @@ msgstr ""
msgid "liveblog entries" msgid "liveblog entries"
msgstr "" msgstr ""
#: liveblog/models.py:97 models.py:173 #: liveblog/models.py:97 models.py:176
msgid "title" msgid "title"
msgstr "" msgstr ""
@ -299,191 +323,195 @@ msgstr ""
msgid "thumbnail size" msgid "thumbnail size"
msgstr "" msgstr ""
#: models.py:64 #: models.py:67
msgid "parent" msgid "parent"
msgstr "" msgstr ""
#: models.py:66 #: models.py:69
msgid "created at" msgid "created at"
msgstr "" msgstr ""
#: models.py:67 #: models.py:70
msgid "modified at" msgid "modified at"
msgstr "" msgstr ""
#: models.py:69 models.py:169 models.py:396 #: models.py:72 models.py:172 models.py:409
msgid "app. config" msgid "app. config"
msgstr "" msgstr ""
#: models.py:73 #: models.py:76
msgid "name" msgid "name"
msgstr "" msgstr ""
#: models.py:74 models.py:174 #: models.py:77 models.py:177
msgid "slug" msgid "slug"
msgstr "" msgstr ""
#: models.py:81 #: models.py:84
msgid "blog category" msgid "blog category"
msgstr "" msgstr ""
#: models.py:82 #: models.py:85
msgid "blog categories" msgid "blog categories"
msgstr "" msgstr ""
#: models.py:138 #: models.py:141
msgid "author" msgid "author"
msgstr "" msgstr ""
#: models.py:141 #: models.py:144
msgid "created" msgid "created"
msgstr "" msgstr ""
#: models.py:142 #: models.py:145
msgid "last modified" msgid "last modified"
msgstr "" msgstr ""
#: models.py:143 #: models.py:146
msgid "published since" msgid "published since"
msgstr "" msgstr ""
#: models.py:144 #: models.py:147
msgid "published until" msgid "published until"
msgstr "" msgstr ""
#: models.py:145 #: models.py:148
msgid "featured date" msgid "featured date"
msgstr "" msgstr ""
#: models.py:146 #: models.py:149
msgid "publish" msgid "publish"
msgstr "" msgstr ""
#: models.py:147 #: models.py:150
msgid "category" msgid "category"
msgstr "" msgstr ""
#: models.py:149 #: models.py:152
msgid "main image" msgid "main image"
msgstr "" msgstr ""
#: models.py:153 #: models.py:156
msgid "main image thumbnail" msgid "main image thumbnail"
msgstr "" msgstr ""
#: models.py:158 #: models.py:161
msgid "main image full" msgid "main image full"
msgstr "" msgstr ""
#: models.py:162 #: models.py:165
msgid "enable comments on post" msgid "enable comments on post"
msgstr "" msgstr ""
#: models.py:164 #: models.py:167
msgid "Site(s)" msgid "Site(s)"
msgstr "" msgstr ""
#: models.py:165 #: models.py:168
msgid "" msgid ""
"Select sites in which to show the post. If none is set it will be visible in " "Select sites in which to show the post. If none is set it will be visible in "
"all the configured sites." "all the configured sites."
msgstr "" msgstr ""
#: models.py:175 #: models.py:179
msgid "abstract" msgid "abstract"
msgstr "" msgstr ""
#: models.py:176 #: models.py:180
msgid "post meta description" msgid "post meta description"
msgstr "" msgstr ""
#: models.py:178 #: models.py:182
msgid "post meta keywords" msgid "post meta keywords"
msgstr "" msgstr ""
#: models.py:180 #: models.py:184
msgid "post meta title" msgid "post meta title"
msgstr "" msgstr ""
#: models.py:181 #: models.py:185
msgid "used in title tag and social sharing" msgid "used in title tag and social sharing"
msgstr "" msgstr ""
#: models.py:184 #: models.py:188
msgid "text" msgid "text"
msgstr "" msgstr ""
#: models.py:189 #: models.py:193
msgid "enable liveblog on post" msgid "enable liveblog on post"
msgstr "" msgstr ""
#: models.py:223 #: models.py:200
msgid "Related Posts"
msgstr ""
#: models.py:233
msgid "blog article" msgid "blog article"
msgstr "" msgstr ""
#: models.py:224 #: models.py:234
msgid "blog articles" msgid "blog articles"
msgstr "" msgstr ""
#: models.py:399 #: models.py:412
msgid "current site" msgid "current site"
msgstr "" msgstr ""
#: models.py:399 #: models.py:412
msgid "Select items from the current site only" msgid "Select items from the current site only"
msgstr "" msgstr ""
#: models.py:403 #: models.py:416
msgid "Plugin template" msgid "Plugin template"
msgstr "" msgstr ""
#: models.py:404 #: models.py:417
msgid "Select plugin template to load for this instance" msgid "Select plugin template to load for this instance"
msgstr "" msgstr ""
#: models.py:438 models.py:474 #: models.py:451 models.py:487
msgid "articles" msgid "articles"
msgstr "" msgstr ""
#: models.py:439 #: models.py:452
msgid "The number of latests articles to be displayed." msgid "The number of latests articles to be displayed."
msgstr "" msgstr ""
#: models.py:441 #: models.py:454
msgid "filter by tag" msgid "filter by tag"
msgstr "" msgstr ""
#: models.py:442 #: models.py:455
msgid "Show only the blog articles tagged with chosen tags." msgid "Show only the blog articles tagged with chosen tags."
msgstr "" msgstr ""
#: models.py:445 #: models.py:458
msgid "filter by category" msgid "filter by category"
msgstr "" msgstr ""
#: models.py:446 #: models.py:459
msgid "Show only the blog articles tagged with chosen categories." msgid "Show only the blog articles tagged with chosen categories."
msgstr "" msgstr ""
#: models.py:450 #: models.py:463
#, python-format #, python-format
msgid "%s latest articles by tag" msgid "%s latest articles by tag"
msgstr "" msgstr ""
#: models.py:470 #: models.py:483
msgid "authors" msgid "authors"
msgstr "" msgstr ""
#: models.py:475 #: models.py:488
msgid "The number of author articles to be displayed." msgid "The number of author articles to be displayed."
msgstr "" msgstr ""
#: models.py:479 #: models.py:492
#, python-format #, python-format
msgid "%s latest articles by author" msgid "%s latest articles by author"
msgstr "" msgstr ""
#: models.py:512 #: models.py:525
msgid "generic blog plugin" msgid "generic blog plugin"
msgstr "" msgstr ""

View file

@ -3,7 +3,7 @@
<h3>{% trans "Categories" %}</h3> <h3>{% trans "Categories" %}</h3>
<ul class="blog-categories"> <ul class="blog-categories">
{% for category in categories %} {% for category in categories %}
<li><a href="{% url 'djangocms_blog:posts-category' category=category.slug %}" class="blog-categories-{{ category.count }}"> <li><a href="{{ category.get_absolute_url }}" class="blog-categories-{{ category.count }}">
{{ category.name }} {{ category.name }}
<span>( <span>(
{% if category.count > 0 %} {% if category.count > 0 %}

View file

@ -13,7 +13,7 @@ Attaching blog to the home page
If you want to attach the blog to the home page you have to adapt settings a bit otherwise the If you want to attach the blog to the home page you have to adapt settings a bit otherwise the
"Just slug" permalink will swallow any CMS page you create. "Just slug" permalink will swallow any CMS page you create.
To avoit this add the following settings to you project:: To avoid this add the following settings to you project::
BLOG_AVAILABLE_PERMALINK_STYLES = ( BLOG_AVAILABLE_PERMALINK_STYLES = (
('full_date', _('Full date')), ('full_date', _('Full date')),

View file

@ -1,115 +0,0 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CustomUser'
db.create_table('test_utils_customuser', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('password', self.gf('django.db.models.fields.CharField')(max_length=128)),
('last_login', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
('is_superuser', self.gf('django.db.models.fields.BooleanField')(default=False)),
('username', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
('first_name', self.gf('django.db.models.fields.CharField')(blank=True, max_length=30)),
('last_name', self.gf('django.db.models.fields.CharField')(blank=True, max_length=30)),
('email', self.gf('django.db.models.fields.EmailField')(blank=True, max_length=75)),
('is_staff', self.gf('django.db.models.fields.BooleanField')(default=False)),
('is_active', self.gf('django.db.models.fields.BooleanField')(default=True)),
('date_joined', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
))
db.send_create_signal('test_utils', ['CustomUser'])
# Adding M2M table for field groups on 'CustomUser'
m2m_table_name = db.shorten_name('test_utils_customuser_groups')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('customuser', models.ForeignKey(orm['test_utils.customuser'], null=False)),
('group', models.ForeignKey(orm['auth.group'], null=False))
))
db.create_unique(m2m_table_name, ['customuser_id', 'group_id'])
# Adding M2M table for field user_permissions on 'CustomUser'
m2m_table_name = db.shorten_name('test_utils_customuser_user_permissions')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('customuser', models.ForeignKey(orm['test_utils.customuser'], null=False)),
('permission', models.ForeignKey(orm['auth.permission'], null=False))
))
db.create_unique(m2m_table_name, ['customuser_id', 'permission_id'])
# Adding M2M table for field sites on 'CustomUser'
m2m_table_name = db.shorten_name('test_utils_customuser_sites')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('customuser', models.ForeignKey(orm['test_utils.customuser'], null=False)),
('site', models.ForeignKey(orm['sites.site'], null=False))
))
db.create_unique(m2m_table_name, ['customuser_id', 'site_id'])
def backwards(self, orm):
# Deleting model 'CustomUser'
db.delete_table('test_utils_customuser')
# Removing M2M table for field groups on 'CustomUser'
db.delete_table(db.shorten_name('test_utils_customuser_groups'))
# Removing M2M table for field user_permissions on 'CustomUser'
db.delete_table(db.shorten_name('test_utils_customuser_user_permissions'))
# Removing M2M table for field sites on 'CustomUser'
db.delete_table(db.shorten_name('test_utils_customuser_sites'))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'blank': 'True', 'to': "orm['auth.Permission']"})
},
'auth.permission': {
'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission', 'ordering': "('content_type__app_label', 'content_type__model', 'codename')"},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'contenttypes.contenttype': {
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'", 'ordering': "('name',)"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'sites.site': {
'Meta': {'object_name': 'Site', 'db_table': "'django_site'", 'ordering': "('domain',)"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'test_utils.customuser': {
'Meta': {'object_name': 'CustomUser'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'blank': 'True', 'max_length': '75'}),
'first_name': ('django.db.models.fields.CharField', [], {'blank': 'True', 'max_length': '30'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'blank': 'True', 'to': "orm['auth.Group']", 'related_name': "'user_set'"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'blank': 'True', 'max_length': '30'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['sites.Site']"}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'blank': 'True', 'to': "orm['auth.Permission']", 'related_name': "'user_set'"}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
}
}
complete_apps = ['test_utils']

View file

@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _