From: Marcin Koziej Date: Mon, 9 Dec 2013 15:07:45 +0000 (+0100) Subject: So many things get better/are improved, but only things that are to be done or broken... X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/29a13b9e77d5a7ac5d26c95488028f88e6b57c2f?ds=sidebyside;hp=3726f9b225fb5c39cbf067f53d4cf6f7d8a9f326 So many things get better/are improved, but only things that are to be done or broken matter. This commit continues this march of complete hopelessness. --- diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index c865d1d87..30b447197 100644 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -74,6 +74,7 @@ class Book(models.Model): from sortify import sortify self.sort_key = sortify(self.title) + self.title = unicode(self.title) # ??? ret = super(Book, self).save(force_insert, force_update, **kwargs) diff --git a/apps/catalogue/models/tag.py b/apps/catalogue/models/tag.py index 7280060a6..f2ce27c45 100644 --- a/apps/catalogue/models/tag.py +++ b/apps/catalogue/models/tag.py @@ -40,6 +40,7 @@ class Tag(TagBase): book_count = models.IntegerField(_('book count'), blank=True, null=True) picture_count = models.IntegerField(_('picture count'), blank=True, null=True) gazeta_link = models.CharField(blank=True, max_length=240) + culturepl_link = models.CharField(blank=True, max_length=240) wiki_link = models.CharField(blank=True, max_length=240) created_at = models.DateTimeField(_('creation date'), auto_now_add=True, db_index=True) @@ -119,7 +120,7 @@ class Tag(TagBase): if self.category == 'book': # never used - objects = Book.objects.none() + objects = Picture.objects.none() elif self.category == 'theme': objects = Picture.tagged.with_all((self,)) elif self.category == 'thing': @@ -195,10 +196,15 @@ class Tag(TagBase): # Allow creating new tag, if it's in default language. tag, created = Tag.objects.get_or_create(slug=slughifi(tag_name), category=category) if created: + tag_name = unicode(tag_name) tag.name = tag_name setattr(tag, "name_%s" % lang, tag_name) tag.sort_key = sortify(tag_sort_key.lower()) - tag.save() + try: + tag.save() + except Exception, e: + import pdb; pdb.set_trace() + raise e meta_tags.append(tag) else: # Ignore unknown tags in non-default languages. diff --git a/apps/catalogue/tasks.py b/apps/catalogue/tasks.py index cb6fd6432..663a5bce4 100644 --- a/apps/catalogue/tasks.py +++ b/apps/catalogue/tasks.py @@ -16,7 +16,7 @@ def touch_tag(tag): 'picture_count': tag.get_picture_count(), 'changed_at': localtime_to_utc(datetime.now()), } - print update_dict + type(tag).objects.filter(pk=tag.pk).update(**update_dict) diff --git a/apps/catalogue/templates/catalogue/tag_list_split.html b/apps/catalogue/templates/catalogue/tag_list_split.html index bc952c1f1..d79618a17 100644 --- a/apps/catalogue/templates/catalogue/tag_list_split.html +++ b/apps/catalogue/templates/catalogue/tag_list_split.html @@ -1,10 +1,18 @@ {% load i18n %} {% if books %} -

{% trans "Literature" %} -{{books|safe}} +

+

+ {% trans "Literature" %} +

+
{{books|safe}}
+
{% endif %} {% if pictures %} -

{% trans "Gallery" %} -{{pictures|safe}} +

+

+ {% trans "Gallery" %} +

+
{{pictures|safe}}
+
{% endif %} diff --git a/apps/catalogue/templates/catalogue/tagged_object_list.html b/apps/catalogue/templates/catalogue/tagged_object_list.html index b729ca917..96b628d59 100644 --- a/apps/catalogue/templates/catalogue/tagged_object_list.html +++ b/apps/catalogue/templates/catalogue/tagged_object_list.html @@ -73,6 +73,11 @@ {% if last_tag.gazeta_link or last_tag.wiki_link %}

{% trans "See also" %}: