Merge pull request #229 from nephila/feature/refactor_get_metadata
Reuse _get_meta_value from django-meta
This commit is contained in:
commit
eff125a3da
3 changed files with 3 additions and 17 deletions
|
@ -242,21 +242,7 @@ class Post(KnockerModel, ModelMeta, TranslatableModel):
|
||||||
Retrieves django-meta attributes from apphook config instance
|
Retrieves django-meta attributes from apphook config instance
|
||||||
:param param: django-meta attribute passed as key
|
:param param: django-meta attribute passed as key
|
||||||
"""
|
"""
|
||||||
attr = None
|
return self._get_meta_value(param, getattr(self.app_config, param)) or ''
|
||||||
value = getattr(self.app_config, param)
|
|
||||||
if value:
|
|
||||||
attr = getattr(self, value, None)
|
|
||||||
if attr is not None:
|
|
||||||
if callable(attr):
|
|
||||||
try:
|
|
||||||
data = attr(param)
|
|
||||||
except TypeError:
|
|
||||||
data = attr()
|
|
||||||
else:
|
|
||||||
data = attr
|
|
||||||
else:
|
|
||||||
data = value
|
|
||||||
return data
|
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
title = self.safe_translation_getter('meta_title', any_language=True)
|
title = self.safe_translation_getter('meta_title', any_language=True)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -36,7 +36,7 @@ setup(
|
||||||
'django-taggit-autosuggest',
|
'django-taggit-autosuggest',
|
||||||
'djangocms-text-ckeditor',
|
'djangocms-text-ckeditor',
|
||||||
'cmsplugin-filer',
|
'cmsplugin-filer',
|
||||||
'django-meta>=1.1',
|
'django-meta>=1.2',
|
||||||
'aldryn-apphooks-config>=0.2.6',
|
'aldryn-apphooks-config>=0.2.6',
|
||||||
'djangocms-apphook-setup',
|
'djangocms-apphook-setup',
|
||||||
'aldryn-search'
|
'aldryn-search'
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -20,7 +20,7 @@ deps =
|
||||||
cms32: https://github.com/divio/django-cms/archive/release/3.2.x.zip
|
cms32: https://github.com/divio/django-cms/archive/release/3.2.x.zip
|
||||||
knocker: https://github.com/divio/django-cms/archive/release/3.2.x.zip
|
knocker: https://github.com/divio/django-cms/archive/release/3.2.x.zip
|
||||||
knocker: https://github.com/nephila/django-knocker/archive/master.zip?0.1.1
|
knocker: https://github.com/nephila/django-knocker/archive/master.zip?0.1.1
|
||||||
django-meta>=1.0b3
|
django-meta>=1.2
|
||||||
https://github.com/nephila/djangocms-helper/archive/develop.zip
|
https://github.com/nephila/djangocms-helper/archive/develop.zip
|
||||||
py26: unittest2
|
py26: unittest2
|
||||||
https://github.com/aldryn/aldryn-apphooks-config/archive/master.zip
|
https://github.com/aldryn/aldryn-apphooks-config/archive/master.zip
|
||||||
|
|
Loading…
Reference in a new issue