@ -1,15 +1,19 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import copy
import copy
from django . db import models
from django . db import models
from django . utils import translation
from django . db . models . signals import post_save
from django . db . models . signals import post_save
from django . utils import translation
from django . utils . html import strip_tags
from django . utils . translation import ugettext_lazy as _
from django . utils . translation import ugettext_lazy as _
from django . conf import settings
from django . conf import settings
from django . core . cache import cache
from django . core . cache import cache
from functions . signal_handlers import post_save_handler
from hvad . models import TranslatableModel , TranslatedFields , TranslationManager
from hvad . models import TranslatableModel , TranslatedFields , TranslationManager
from pymorphy . django_conf import default_morph as morph
from pymorphy . django_conf import default_morph as morph
from functions . signal_handlers import post_save_handler
# additional funcs
# additional funcs
def get_month_inflect ( value , key ) :
def get_month_inflect ( value , key ) :
@ -117,6 +121,12 @@ class MetaSetting(TranslatableModel):
except :
except :
pass
pass
if obj and getattr ( obj , ' description ' , None ) :
try :
description = strip_tags ( obj . description ) . strip ( ' \n ' ) . splitlines ( ) [ 0 ] [ : 200 ]
except ( IndexError , ) :
pass
return { ' title ' : title , ' description ' : description , ' keywords ' : keywords , ' h1 ' : h1 }
return { ' title ' : title , ' description ' : description , ' keywords ' : keywords , ' h1 ' : h1 }
def get_param ( self , obj , field ) :
def get_param ( self , obj , field ) :