Use types from django-meta-mixin
This commit is contained in:
parent
c5e0227565
commit
ccd27bdb99
5 changed files with 70 additions and 35 deletions
|
|
@ -144,6 +144,7 @@ class BlogConfigAdmin(BaseAppHookConfig, TranslatableAdmin):
|
|||
('Layout', {
|
||||
'fields': (
|
||||
'config.paginate_by', 'config.url_patterns', 'config.template_prefix',
|
||||
'config.menu_structure',
|
||||
),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
|
|
@ -155,7 +156,7 @@ class BlogConfigAdmin(BaseAppHookConfig, TranslatableAdmin):
|
|||
('Open Graph', {
|
||||
'fields': (
|
||||
'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', {
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ class Post(ModelMeta, TranslatableModel):
|
|||
'og_profile_id': 'get_meta_attribute',
|
||||
'og_publisher': 'get_meta_attribute',
|
||||
'og_author_url': 'get_meta_attribute',
|
||||
'og_author': 'get_meta_attribute',
|
||||
'twitter_type': 'get_meta_attribute',
|
||||
'twitter_site': 'get_meta_attribute',
|
||||
'twitter_author': 'get_meta_attribute',
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
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):
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from meta_mixin import settings as meta_settings
|
||||
|
||||
OBJECT_TYPES = (
|
||||
('Article', _('Article')),
|
||||
('Website', _('Website')),
|
||||
)
|
||||
BLOG_TYPES = getattr(settings, 'BLOG_TYPES', OBJECT_TYPES)
|
||||
|
||||
PERMALINKS = (
|
||||
('full_date', _('Full date')),
|
||||
('short_date', _('Year / Month')),
|
||||
|
|
@ -25,7 +24,12 @@ def get_setting(name):
|
|||
'category': r'^(?P<category>\w[-\w]*)/(?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 = {
|
||||
'BLOG_IMAGE_THUMBNAIL_SIZE': getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', {
|
||||
'size': '120x120',
|
||||
|
|
@ -39,28 +43,28 @@ def get_setting(name):
|
|||
'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_LATEST_POSTS': getattr(settings, 'BLOG_LATEST_POSTS', 5),
|
||||
'BLOG_POSTS_LIST_TRUNCWORDS_COUNT': getattr(
|
||||
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_TYPES': BLOG_TYPES,
|
||||
'BLOG_TYPES': meta_settings.OBJECT_TYPES,
|
||||
'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_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_AUTHOR_URL': getattr(settings, 'BLOG_FB_AUTHOR_URL', 'get_author_url'),
|
||||
'BLOG_FB_AUTHOR': getattr(settings, 'BLOG_FB_AUTHOR', 'get_author_name'),
|
||||
'BLOG_TWITTER_TYPE': getattr(settings, 'BLOG_TWITTER_TYPE', 'Summary'),
|
||||
'BLOG_TWITTER_TYPES': getattr(settings, 'BLOG_TWITTER_TYPES', BLOG_TYPES),
|
||||
'BLOG_TWITTER_TYPE': getattr(settings, 'BLOG_TWITTER_TYPE', 'summary'),
|
||||
'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_AUTHOR': getattr(settings, 'BLOG_TWITTER_AUTHOR', 'get_author_twitter'),
|
||||
'BLOG_GPLUS_TYPE': getattr(settings, 'BLOG_GPLUS_SCOPE_CATEGORY', 'Blog'),
|
||||
'BLOG_GPLUS_TYPES': getattr(settings, 'BLOG_GPLUS_TYPES', BLOG_TYPES),
|
||||
'BLOG_GPLUS_TYPE': getattr(settings, 'BLOG_GPLUS_TYPE', 'Blog'),
|
||||
'BLOG_GPLUS_TYPES': getattr(settings, 'BLOG_GPLUS_TYPES', meta_settings.GPLUS_TYPES),
|
||||
'BLOG_GPLUS_AUTHOR': getattr(settings, 'BLOG_GPLUS_AUTHOR', 'get_author_gplus'),
|
||||
'BLOG_ENABLE_COMMENTS': getattr(settings, 'BLOG_ENABLE_COMMENTS', True),
|
||||
'BLOG_USE_ABSTRACT': getattr(settings, 'BLOG_USE_ABSTRACT', True),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue