X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/64af15fe792f42d3a7dc3e857a45577d16806255..084f20588e607aa9ae3ed280b6a2f0349b6a3200:/src/pdcounter/models.py diff --git a/src/pdcounter/models.py b/src/pdcounter/models.py index 24866fee5..7d6181d60 100644 --- a/src/pdcounter/models.py +++ b/src/pdcounter/models.py @@ -1,10 +1,9 @@ -# -*- 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. # from django.conf import settings from django.db import models -from django.db.models import permalink +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from datetime import datetime from django.db.models.signals import post_save, post_delete @@ -28,15 +27,14 @@ class Author(models.Model): def category(self): return "author" - def __unicode__(self): + def __str__(self): return self.name def __repr__(self): return "Author(slug=%r)" % self.slug - @permalink def get_absolute_url(self): - return 'tagged_object_list', [self.url_chunk] + return reverse('tagged_object_list', args=[self.url_chunk]) def has_description(self): return len(self.description) > 0 @@ -71,12 +69,11 @@ class BookStub(models.Model): verbose_name = _('book stub') verbose_name_plural = _('book stubs') - def __unicode__(self): + def __str__(self): return self.title - @permalink def get_absolute_url(self): - return 'book_detail', [self.slug] + return reverse('book_detail', args=[self.slug]) def in_pd(self): return self.pd is not None and self.pd <= datetime.now().year