From: Radek Czajka Date: Mon, 4 Jan 2016 12:19:51 +0000 (+0100) Subject: Initial not None. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d36673cef5c5f35b1043a03e6c5ddbb7688788ae?ds=inline Initial not None. --- diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 1524c3456..9381afc94 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -100,7 +100,7 @@ class Book(models.Model): try: return re.search(r'\w', self.title, re.U).group(0) except AttributeError: - return None + return '' def author_str(self): return ", ".join(str(t) for t in self.tags.filter(category='author')) diff --git a/src/catalogue/models/collection.py b/src/catalogue/models/collection.py index bae1cc418..d51932841 100644 --- a/src/catalogue/models/collection.py +++ b/src/catalogue/models/collection.py @@ -33,7 +33,7 @@ class Collection(models.Model): try: return re.search(r'\w', self.title, re.U).group(0) except AttributeError: - return None + return '' @models.permalink def get_absolute_url(self): diff --git a/src/catalogue/models/tag.py b/src/catalogue/models/tag.py index 5575d6a14..89ca65185 100644 --- a/src/catalogue/models/tag.py +++ b/src/catalogue/models/tag.py @@ -134,7 +134,7 @@ class Tag(TagBase): elif self.name: return self.name[0] else: - return None + return '' @permalink def get_absolute_url(self): diff --git a/src/catalogue/templatetags/catalogue_tags.py b/src/catalogue/templatetags/catalogue_tags.py index fd914e321..ce23e548f 100644 --- a/src/catalogue/templatetags/catalogue_tags.py +++ b/src/catalogue/templatetags/catalogue_tags.py @@ -348,7 +348,7 @@ def work_list(context, object_list): @register.inclusion_tag('catalogue/plain_list.html', takes_context=True) def plain_list(context, object_list, with_initials=True, by_author=False, choice=None, book=None, gallery=False, paged=True): - names = [(None, [])] + names = [('', [])] last_initial = None for obj in object_list: if with_initials: