Browse Source

PageTitlesFunctionMixin: __str__ without HTML.

master 0.2.22
Erik Stein 6 years ago
parent
commit
41cd99b0b0
  1. 3
      CHANGES
  2. 12
      shared/utils/models/pages.py

3
CHANGES

@ -1,3 +1,6 @@
0.2.22 2019-02-20
- PageTitlesFunctionMixin: __str__ without HTML.
0.2.21 2019-02-19
- Mock datetime for preview.
- Class based daterange views.

12
shared/utils/models/pages.py

@ -35,9 +35,10 @@ else:
# TODO Leave window_title alone, do not slimdown
@python_2_unicode_compatible
class PageTitlesFunctionMixin(object):
def __str__(self):
return strip_tags(slimdown(self.get_short_title()))
return strip_tags(self.get_short_title())
def get_title(self):
return slimdown(firstof(
@ -76,9 +77,7 @@ class PageTitlesFunctionMixin(object):
)
# TODO Use translatable fields by default
@python_2_unicode_compatible
class PageTitlesMixin(models.Model, PageTitlesFunctionMixin):
class PageTitlesMixin(PageTitlesFunctionMixin, models.Model):
"""
A model mixin containg title and slug field for models serving as website
pages with an URL.
@ -98,13 +97,10 @@ class PageTitlesMixin(models.Model, PageTitlesFunctionMixin):
class Meta:
abstract = True
def __str__(self):
return self.name
# FIXME short_title is deprecated
@property
def short_title(self):
return self.name
return self.get_short_title()
@short_title.setter
def short_title(self, value):

Loading…
Cancel
Save