Initial not None.
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 4 Jan 2016 12:19:51 +0000 (13:19 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 4 Jan 2016 12:19:51 +0000 (13:19 +0100)
src/catalogue/models/book.py
src/catalogue/models/collection.py
src/catalogue/models/tag.py
src/catalogue/templatetags/catalogue_tags.py

index 1524c34..9381afc 100644 (file)
@@ -100,7 +100,7 @@ class Book(models.Model):
         try:
             return re.search(r'\w', self.title, re.U).group(0)
         except AttributeError:
         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'))
 
     def author_str(self):
         return ", ".join(str(t) for t in self.tags.filter(category='author'))
index bae1cc4..d519328 100644 (file)
@@ -33,7 +33,7 @@ class Collection(models.Model):
         try:
             return re.search(r'\w', self.title, re.U).group(0)
         except AttributeError:
         try:
             return re.search(r'\w', self.title, re.U).group(0)
         except AttributeError:
-            return None
+            return ''
 
     @models.permalink
     def get_absolute_url(self):
 
     @models.permalink
     def get_absolute_url(self):
index 5575d6a..89ca651 100644 (file)
@@ -134,7 +134,7 @@ class Tag(TagBase):
         elif self.name:
             return self.name[0]
         else:
         elif self.name:
             return self.name[0]
         else:
-            return None
+            return ''
 
     @permalink
     def get_absolute_url(self):
 
     @permalink
     def get_absolute_url(self):
index fd914e3..ce23e54 100644 (file)
@@ -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):
 
 @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:
     last_initial = None
     for obj in object_list:
         if with_initials: