Clarify meta tags fields in BlogConfig
This commit is contained in:
parent
2490447f44
commit
0e9a80cb42
4 changed files with 25 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ from django import forms
|
|||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from parler.admin import TranslatableAdmin
|
||||
|
||||
from .cms_appconfig import BlogConfig
|
||||
|
|
@ -157,16 +158,25 @@ class BlogConfigAdmin(BaseAppHookConfig, TranslatableAdmin):
|
|||
'fields': (
|
||||
'config.og_type', 'config.og_app_id', 'config.og_profile_id',
|
||||
'config.og_publisher', 'config.og_author_url', 'config.og_author',
|
||||
),
|
||||
'description': _(
|
||||
'You can provide plain strings, Post model attribute or method names'
|
||||
)
|
||||
}),
|
||||
('Twitter', {
|
||||
'fields': (
|
||||
'config.twitter_type', 'config.twitter_site', 'config.twitter_author',
|
||||
),
|
||||
'description': _(
|
||||
'You can provide plain strings, Post model attribute or method names'
|
||||
)
|
||||
}),
|
||||
('Google+', {
|
||||
'fields': (
|
||||
'config.gplus_type', 'config.gplus_author',
|
||||
),
|
||||
'description': _(
|
||||
'You can provide plain strings, Post model attribute or method names'
|
||||
)
|
||||
}),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class Post(ModelMeta, TranslatableModel):
|
|||
'og_description': 'get_description',
|
||||
'twitter_description': 'get_description',
|
||||
'gplus_description': 'get_description',
|
||||
'locale': None,
|
||||
'locale': 'get_locale',
|
||||
'image': 'get_image_full_url',
|
||||
'object_type': 'get_meta_attribute',
|
||||
'og_type': 'get_meta_attribute',
|
||||
|
|
@ -233,6 +233,9 @@ class Post(ModelMeta, TranslatableModel):
|
|||
def get_keywords(self):
|
||||
return self.safe_translation_getter('meta_keywords').strip().split(',')
|
||||
|
||||
def get_locale(self):
|
||||
return self.get_current_language()
|
||||
|
||||
def get_description(self):
|
||||
description = self.safe_translation_getter('meta_description', any_language=True)
|
||||
if not description:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue