X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b2d342589a7889a3b096e7192453d53bd28eed7d..eee26362c631db7fd31cc210694dedd6f8f2961b:/src/catalogue/models/source.py diff --git a/src/catalogue/models/source.py b/src/catalogue/models/source.py index bcf5254bb..b2259d467 100644 --- a/src/catalogue/models/source.py +++ b/src/catalogue/models/source.py @@ -1,23 +1,21 @@ -# -*- coding: utf-8 -*- -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # from django.db import models -from django.utils.translation import ugettext_lazy as _ class Source(models.Model): """A collection of books, which might be defined before publishing them.""" - netloc = models.CharField(_('network location'), max_length=120, primary_key=True) - name = models.CharField(_('name'), max_length=120, blank=True) + netloc = models.CharField('położenie sieciowe', max_length=120, primary_key=True) + name = models.CharField('nazwa', max_length=120, blank=True) class Meta: ordering = ('netloc',) - verbose_name = _('source') - verbose_name_plural = _('sources') + verbose_name = 'źródło' + verbose_name_plural = 'źródła' app_label = 'catalogue' - def __unicode__(self): + def __str__(self): return self.netloc def save(self, *args, **kwargs): @@ -26,7 +24,7 @@ class Source(models.Model): str(self.pk) old_self = type(self).objects.get(pk=self) except type(self).DoesNotExist: - old_name = u'' + old_name = '' old_netloc = self.netloc else: old_name = old_self.name @@ -38,7 +36,7 @@ class Source(models.Model): # and invalidate their cached includes. if old_name != self.name or old_netloc != self.netloc: for book in Book.objects.all(): - source = book.extra_info.get('source_url', '') + source = book.get_extra_info_json().get('source_url', '') if self.netloc in source or (old_netloc != self.netloc and old_netloc in source): - book.flush_includes() + book.clear_cache() return ret