Use types from django-meta-mixin
This commit is contained in:
parent
c5e0227565
commit
ccd27bdb99
5 changed files with 70 additions and 35 deletions
63
README.rst
63
README.rst
|
@ -197,6 +197,7 @@ Features
|
||||||
* Support for Twitter cards, Open Graph and Google+ snippets meta tags
|
* Support for Twitter cards, Open Graph and Google+ snippets meta tags
|
||||||
* Optional support for simpler TextField-based content editing
|
* Optional support for simpler TextField-based content editing
|
||||||
* Multisite support (posts can be visible in one or more Django sites on the same project)
|
* Multisite support (posts can be visible in one or more Django sites on the same project)
|
||||||
|
* Per-apphook configuration
|
||||||
|
|
||||||
Import from Wordpress
|
Import from Wordpress
|
||||||
+++++++++++++++++++++
|
+++++++++++++++++++++
|
||||||
|
@ -206,15 +207,8 @@ https://pypi.python.org/pypi/the-real-django-wordpress and
|
||||||
this gist https://gist.github.com/yakky/11336204 as a base.
|
this gist https://gist.github.com/yakky/11336204 as a base.
|
||||||
|
|
||||||
|
|
||||||
Settings
|
Global Settings
|
||||||
--------
|
---------------
|
||||||
* BLOG_ENABLE_COMMENTS: Whether to enable comments by default on posts;
|
|
||||||
while ``djangocms_blog`` does not ship any comment system, this flag can be used
|
|
||||||
to control the chosen comments framework; (default: True)
|
|
||||||
* BLOG_USE_PLACEHOLDER: Post content is managed via placeholder; if ``False`` a
|
|
||||||
simple HTMLField is used; (default: True)
|
|
||||||
* BLOG_USE_ABSTRACT: Use an abstract field for the post; if ``False`` no abstract field
|
|
||||||
is available for every post; (default: True)
|
|
||||||
* BLOG_IMAGE_THUMBNAIL_SIZE: Size of the main image when shown on the post lists;
|
* BLOG_IMAGE_THUMBNAIL_SIZE: Size of the main image when shown on the post lists;
|
||||||
it's a dictionary with ``size``, ``crop`` and ``upscale`` keys;
|
it's a dictionary with ``size``, ``crop`` and ``upscale`` keys;
|
||||||
(default: ``{'size': '120x120', 'crop': True,'upscale': False}``)
|
(default: ``{'size': '120x120', 'crop': True,'upscale': False}``)
|
||||||
|
@ -224,27 +218,62 @@ Settings
|
||||||
* BLOG_PAGINATION: Number of post per page; (default: 10)
|
* BLOG_PAGINATION: Number of post per page; (default: 10)
|
||||||
* BLOG_LATEST_POSTS: Default number of post in the **Latest post** plugin; (default: 5)
|
* BLOG_LATEST_POSTS: Default number of post in the **Latest post** plugin; (default: 5)
|
||||||
* BLOG_POSTS_LIST_TRUNCWORDS_COUNT: Default number of words shown for abstract in the post list; (default: 100)
|
* BLOG_POSTS_LIST_TRUNCWORDS_COUNT: Default number of words shown for abstract in the post list; (default: 100)
|
||||||
* BLOG_MULTISITE: Add support for multisite setup
|
|
||||||
* BLOG_AUTHOR_DEFAULT: Use a default if not specified; if set to ``True`` the
|
|
||||||
current user is set as the default author, if set to ``False`` no default
|
|
||||||
author is set, if set to a string the user with the provided username is
|
|
||||||
used; (default: True)
|
|
||||||
|
|
||||||
Social media tags settings
|
|
||||||
++++++++++++++++++++++++++
|
|
||||||
* BLOG_TYPE: Generic type for the post object; (default: Article)
|
* BLOG_TYPE: Generic type for the post object; (default: Article)
|
||||||
|
* BLOG_TYPES: Choices of available blog types; (default: Article, Website)
|
||||||
* BLOG_FB_TYPE: Open Graph type for the post object; (default: Article)
|
* BLOG_FB_TYPE: Open Graph type for the post object; (default: Article)
|
||||||
|
* BLOG_FB_TYPES: Choices of available blog types; (default: Article, Website)
|
||||||
* BLOG_FB_APPID: Facebook Application ID
|
* BLOG_FB_APPID: Facebook Application ID
|
||||||
* BLOG_FB_PROFILE_ID: Facebook profile ID of the post author
|
* BLOG_FB_PROFILE_ID: Facebook profile ID of the post author
|
||||||
* BLOG_FB_PUBLISHER: Facebook URL of the blog publisher
|
* BLOG_FB_PUBLISHER: Facebook URL of the blog publisher
|
||||||
* BLOG_FB_AUTHOR_URL: Facebook profile URL of the post author
|
* BLOG_FB_AUTHOR_URL: Facebook profile URL of the post author
|
||||||
* BLOG_FB_AUTHOR: Facebook profile URL of the post author
|
* BLOG_FB_AUTHOR: Facebook profile URL of the post author
|
||||||
* BLOG_TWITTER_TYPE: Twitter Card type for the post object; (default: Summary)
|
* BLOG_TWITTER_TYPE: Twitter Card type for the post object; (default: Summary)
|
||||||
|
* BLOG_TWITTER_TYPES: Choices of available blog types for twitter; (default: Article, Website)
|
||||||
* BLOG_TWITTER_SITE: Twitter account of the site
|
* BLOG_TWITTER_SITE: Twitter account of the site
|
||||||
* BLOG_TWITTER_AUTHOR: Twitter account of the post author
|
* BLOG_TWITTER_AUTHOR: Twitter account of the post author
|
||||||
* BLOG_GPLUS_TYPE: Google+ Snippet type for the post object; (default: Blog)
|
* BLOG_GPLUS_TYPE: Google+ Snippet type for the post object; (default: Blog)
|
||||||
|
* BLOG_GPLUS_TYPES: Choices of available blog types for twitter; (default: Article, Website)
|
||||||
* BLOG_GPLUS_AUTHOR: Google+ account of the post author
|
* BLOG_GPLUS_AUTHOR: Google+ account of the post author
|
||||||
|
* BLOG_ENABLE_COMMENTS: Whether to enable comments by default on posts;
|
||||||
|
while ``djangocms_blog`` does not ship any comment system, this flag can be used
|
||||||
|
to control the chosen comments framework; (default: True)
|
||||||
|
* BLOG_USE_ABSTRACT: Use an abstract field for the post; if ``False`` no abstract field
|
||||||
|
is available for every post; (default: True)
|
||||||
|
* BLOG_USE_PLACEHOLDER: Post content is managed via placeholder; if ``False`` a
|
||||||
|
simple HTMLField is used; (default: True)
|
||||||
|
* BLOG_MULTISITE: Add support for multisite setup
|
||||||
|
* BLOG_MENU_TYPE: Structure of the Blog menu; (default: Posts and Categories)
|
||||||
|
* BLOG_AUTHOR_DEFAULT: Use a default if not specified; if set to ``True`` the
|
||||||
|
current user is set as the default author, if set to ``False`` no default
|
||||||
|
author is set, if set to a string the user with the provided username is
|
||||||
|
used; (default: True)
|
||||||
|
* BLOG_DEFAULT_PUBLISHED: If posts are marked as published by default; (default: False)
|
||||||
|
* BLOG_AVAILABLE_PERMALINK_STYLES: Choices of permalinks styles;
|
||||||
|
* BLOG_PERMALINK_URLS: URLConf corresponding to BLOG_AVAILABLE_PERMALINK_STYLES;
|
||||||
|
|
||||||
|
Per-Apphook settings
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* default_published: Per-apphook setting for BLOG_DEFAULT_PUBLISHED;
|
||||||
|
* Permalink structure: Per-apphook setting for BLOG_AVAILABLE_PERMALINK_STYLES;
|
||||||
|
* Use placeholder and plugins for article body: Per-apphook setting for BLOG_USE_PLACEHOLDER;
|
||||||
|
* Use abstract field: Per-apphook setting for BLOG_USE_ABSTRACT;
|
||||||
|
* Set author: Per-apphook setting for BLOG_AUTHOR_DEFAULT;
|
||||||
|
* Paginate sizePer-apphook setting for BLOG_PAGINATION;
|
||||||
|
* Template prefix: Alternative directory to load the blog templates from;
|
||||||
|
* Menu structure: Per-apphook setting for BLOG_MENU_TYPE
|
||||||
|
* Object type:Per-apphook setting for BLOG_TYPE
|
||||||
|
* Facebook type: Per-apphook setting for BLOG_FB_TYPE
|
||||||
|
* Facebook application ID: Per-apphook setting for BLOG_FB_APP_ID
|
||||||
|
* Facebook profile ID: Per-apphook setting for BLOG_FB_PROFILE_ID
|
||||||
|
* Facebook page URL: Per-apphook setting for BLOG_FB_PUBLISHER
|
||||||
|
* Facebook author URL: Per-apphook setting for BLOG_AUTHOR_URL
|
||||||
|
* Facebook author: Per-apphook setting for BLOG_AUTHOR
|
||||||
|
* Twitter type: Per-apphook setting for BLOG_TWITTER_TYPE
|
||||||
|
* Twitter site handle: Per-apphook setting for BLOG_TWITTER_SITE
|
||||||
|
* Twitter author handle: Per-apphook setting for BLOG_TWITTER_AUTHOR
|
||||||
|
* Google+ type: Per-apphook setting for BLOG_GPLUS_TYPE
|
||||||
|
* Google+ author name: Per-apphook setting for BLOG_GPLUS_AUTHOR
|
||||||
|
|
||||||
Known djangocms-blog websites
|
Known djangocms-blog websites
|
||||||
+++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++
|
||||||
|
|
|
@ -144,6 +144,7 @@ class BlogConfigAdmin(BaseAppHookConfig, TranslatableAdmin):
|
||||||
('Layout', {
|
('Layout', {
|
||||||
'fields': (
|
'fields': (
|
||||||
'config.paginate_by', 'config.url_patterns', 'config.template_prefix',
|
'config.paginate_by', 'config.url_patterns', 'config.template_prefix',
|
||||||
|
'config.menu_structure',
|
||||||
),
|
),
|
||||||
'classes': ('collapse',)
|
'classes': ('collapse',)
|
||||||
}),
|
}),
|
||||||
|
@ -155,7 +156,7 @@ class BlogConfigAdmin(BaseAppHookConfig, TranslatableAdmin):
|
||||||
('Open Graph', {
|
('Open Graph', {
|
||||||
'fields': (
|
'fields': (
|
||||||
'config.og_type', 'config.og_app_id', 'config.og_profile_id',
|
'config.og_type', 'config.og_app_id', 'config.og_profile_id',
|
||||||
'config.og_publisher', 'config.og_author_url',
|
'config.og_publisher', 'config.og_author_url', 'config.og_author',
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
('Twitter', {
|
('Twitter', {
|
||||||
|
|
|
@ -158,6 +158,7 @@ class Post(ModelMeta, TranslatableModel):
|
||||||
'og_profile_id': 'get_meta_attribute',
|
'og_profile_id': 'get_meta_attribute',
|
||||||
'og_publisher': 'get_meta_attribute',
|
'og_publisher': 'get_meta_attribute',
|
||||||
'og_author_url': 'get_meta_attribute',
|
'og_author_url': 'get_meta_attribute',
|
||||||
|
'og_author': 'get_meta_attribute',
|
||||||
'twitter_type': 'get_meta_attribute',
|
'twitter_type': 'get_meta_attribute',
|
||||||
'twitter_site': 'get_meta_attribute',
|
'twitter_site': 'get_meta_attribute',
|
||||||
'twitter_author': 'get_meta_attribute',
|
'twitter_author': 'get_meta_attribute',
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import, print_function, unicode_literals
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
MENU_TYPE_COMPLETE = 'complete'
|
||||||
|
MENU_TYPE_CATEGORIES = 'categories'
|
||||||
|
MENU_TYPE_POSTS = 'posts'
|
||||||
|
MENU_TYPE_NONE = 'none'
|
||||||
|
|
||||||
|
|
||||||
def get_setting(name):
|
def get_setting(name):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from meta_mixin import settings as meta_settings
|
from meta_mixin import settings as meta_settings
|
||||||
|
|
||||||
OBJECT_TYPES = (
|
|
||||||
('Article', _('Article')),
|
|
||||||
('Website', _('Website')),
|
|
||||||
)
|
|
||||||
BLOG_TYPES = getattr(settings, 'BLOG_TYPES', OBJECT_TYPES)
|
|
||||||
|
|
||||||
PERMALINKS = (
|
PERMALINKS = (
|
||||||
('full_date', _('Full date')),
|
('full_date', _('Full date')),
|
||||||
('short_date', _('Year / Month')),
|
('short_date', _('Year / Month')),
|
||||||
|
@ -25,7 +24,12 @@ def get_setting(name):
|
||||||
'category': r'^(?P<category>\w[-\w]*)/(?P<slug>\w[-\w]*)/$',
|
'category': r'^(?P<category>\w[-\w]*)/(?P<slug>\w[-\w]*)/$',
|
||||||
'slug': r'^(?P<slug>\w[-\w]*)/$',
|
'slug': r'^(?P<slug>\w[-\w]*)/$',
|
||||||
}
|
}
|
||||||
|
MENU_TYPES = (
|
||||||
|
(MENU_TYPE_COMPLETE, _('Categories and posts')),
|
||||||
|
(MENU_TYPE_CATEGORIES, _('Categories only')),
|
||||||
|
(MENU_TYPE_POSTS, _('Posts only')),
|
||||||
|
(MENU_TYPE_NONE, _('None')),
|
||||||
|
)
|
||||||
default = {
|
default = {
|
||||||
'BLOG_IMAGE_THUMBNAIL_SIZE': getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', {
|
'BLOG_IMAGE_THUMBNAIL_SIZE': getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', {
|
||||||
'size': '120x120',
|
'size': '120x120',
|
||||||
|
@ -39,28 +43,28 @@ def get_setting(name):
|
||||||
'upscale': False
|
'upscale': False
|
||||||
}),
|
}),
|
||||||
|
|
||||||
'BLOG_TAGCLOUD_MIN': getattr(settings, 'BLOG_TAGCLOUD_MIN', 1),
|
|
||||||
'BLOG_TAGCLOUD_MAX': getattr(settings, 'BLOG_TAGCLOUD_MAX', 10),
|
|
||||||
'BLOG_PAGINATION': getattr(settings, 'BLOG_PAGINATION', 10),
|
'BLOG_PAGINATION': getattr(settings, 'BLOG_PAGINATION', 10),
|
||||||
'BLOG_LATEST_POSTS': getattr(settings, 'BLOG_LATEST_POSTS', 5),
|
'BLOG_LATEST_POSTS': getattr(settings, 'BLOG_LATEST_POSTS', 5),
|
||||||
'BLOG_POSTS_LIST_TRUNCWORDS_COUNT': getattr(
|
'BLOG_POSTS_LIST_TRUNCWORDS_COUNT': getattr(
|
||||||
settings, 'BLOG_POSTS_LIST_TRUNCWORDS_COUNT', 100
|
settings, 'BLOG_POSTS_LIST_TRUNCWORDS_COUNT', 100
|
||||||
),
|
),
|
||||||
|
'BLOG_MENU_TYPE': MENU_TYPES,
|
||||||
|
'BLOG_MENU_TYPES': MENU_TYPES,
|
||||||
'BLOG_TYPE': getattr(settings, 'BLOG_TYPE', 'Article'),
|
'BLOG_TYPE': getattr(settings, 'BLOG_TYPE', 'Article'),
|
||||||
'BLOG_TYPES': BLOG_TYPES,
|
'BLOG_TYPES': meta_settings.OBJECT_TYPES,
|
||||||
'BLOG_FB_TYPE': getattr(settings, 'BLOG_FB_TYPE', 'Article'),
|
'BLOG_FB_TYPE': getattr(settings, 'BLOG_FB_TYPE', 'Article'),
|
||||||
'BLOG_FB_TYPES': getattr(settings, 'BLOG_FB_TYPES', BLOG_TYPES),
|
'BLOG_FB_TYPES': getattr(settings, 'BLOG_FB_TYPES', meta_settings.FB_TYPES),
|
||||||
'BLOG_FB_APPID': getattr(settings, 'BLOG_FB_APPID', meta_settings.FB_APPID),
|
'BLOG_FB_APPID': getattr(settings, 'BLOG_FB_APPID', meta_settings.FB_APPID),
|
||||||
'BLOG_FB_PROFILE_ID': getattr(settings, 'BLOG_FB_PROFILE_ID', meta_settings.FB_PROFILE_ID),
|
'BLOG_FB_PROFILE_ID': getattr(settings, 'BLOG_FB_PROFILE_ID', meta_settings.FB_PROFILE_ID),
|
||||||
'BLOG_FB_PUBLISHER': getattr(settings, 'BLOG_FB_PUBLISHER', meta_settings.FB_PUBLISHER),
|
'BLOG_FB_PUBLISHER': getattr(settings, 'BLOG_FB_PUBLISHER', meta_settings.FB_PUBLISHER),
|
||||||
'BLOG_FB_AUTHOR_URL': getattr(settings, 'BLOG_FB_AUTHOR_URL', 'get_author_url'),
|
'BLOG_FB_AUTHOR_URL': getattr(settings, 'BLOG_FB_AUTHOR_URL', 'get_author_url'),
|
||||||
'BLOG_FB_AUTHOR': getattr(settings, 'BLOG_FB_AUTHOR', 'get_author_name'),
|
'BLOG_FB_AUTHOR': getattr(settings, 'BLOG_FB_AUTHOR', 'get_author_name'),
|
||||||
'BLOG_TWITTER_TYPE': getattr(settings, 'BLOG_TWITTER_TYPE', 'Summary'),
|
'BLOG_TWITTER_TYPE': getattr(settings, 'BLOG_TWITTER_TYPE', 'summary'),
|
||||||
'BLOG_TWITTER_TYPES': getattr(settings, 'BLOG_TWITTER_TYPES', BLOG_TYPES),
|
'BLOG_TWITTER_TYPES': getattr(settings, 'BLOG_TWITTER_TYPES', meta_settings.TWITTER_TYPES),
|
||||||
'BLOG_TWITTER_SITE': getattr(settings, 'BLOG_TWITTER_SITE', meta_settings.TWITTER_SITE),
|
'BLOG_TWITTER_SITE': getattr(settings, 'BLOG_TWITTER_SITE', meta_settings.TWITTER_SITE),
|
||||||
'BLOG_TWITTER_AUTHOR': getattr(settings, 'BLOG_TWITTER_AUTHOR', 'get_author_twitter'),
|
'BLOG_TWITTER_AUTHOR': getattr(settings, 'BLOG_TWITTER_AUTHOR', 'get_author_twitter'),
|
||||||
'BLOG_GPLUS_TYPE': getattr(settings, 'BLOG_GPLUS_SCOPE_CATEGORY', 'Blog'),
|
'BLOG_GPLUS_TYPE': getattr(settings, 'BLOG_GPLUS_TYPE', 'Blog'),
|
||||||
'BLOG_GPLUS_TYPES': getattr(settings, 'BLOG_GPLUS_TYPES', BLOG_TYPES),
|
'BLOG_GPLUS_TYPES': getattr(settings, 'BLOG_GPLUS_TYPES', meta_settings.GPLUS_TYPES),
|
||||||
'BLOG_GPLUS_AUTHOR': getattr(settings, 'BLOG_GPLUS_AUTHOR', 'get_author_gplus'),
|
'BLOG_GPLUS_AUTHOR': getattr(settings, 'BLOG_GPLUS_AUTHOR', 'get_author_gplus'),
|
||||||
'BLOG_ENABLE_COMMENTS': getattr(settings, 'BLOG_ENABLE_COMMENTS', True),
|
'BLOG_ENABLE_COMMENTS': getattr(settings, 'BLOG_ENABLE_COMMENTS', True),
|
||||||
'BLOG_USE_ABSTRACT': getattr(settings, 'BLOG_USE_ABSTRACT', True),
|
'BLOG_USE_ABSTRACT': getattr(settings, 'BLOG_USE_ABSTRACT', True),
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -47,8 +47,8 @@ setup(
|
||||||
'djangocms-text-ckeditor',
|
'djangocms-text-ckeditor',
|
||||||
'cmsplugin-filer',
|
'cmsplugin-filer',
|
||||||
'django-meta>=0.2',
|
'django-meta>=0.2',
|
||||||
'django-meta-mixin>=0.1.1',
|
'django-meta-mixin>=0.2.1',
|
||||||
'aldryn-apphooks-config',
|
'aldryn-apphooks-config>=0.2.6',
|
||||||
],
|
],
|
||||||
license='BSD',
|
license='BSD',
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
|
|
Loading…
Add table
Reference in a new issue