-# -*- coding: utf-8 -*-\r
-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.\r
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.\r
+# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.\r
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.\r
#\r
from django.db import models\r
-from django.utils.translation import ugettext_lazy as _\r
+from django.urls import reverse\r
\r
\r
class Catalog(models.Model):\r
"""Represents a dictionary of libraries"""\r
\r
- name = models.CharField(_('name'), max_length=120, null=False)\r
- slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True)\r
+ name = models.CharField('nazwa', max_length=120, null=False)\r
+ slug = models.SlugField('slug', max_length=120, unique=True, db_index=True)\r
\r
class Meta:\r
- verbose_name = _('catalog')\r
- verbose_name_plural = _('catalogs')\r
+ verbose_name = 'katalog'\r
+ verbose_name_plural = 'katalogi'\r
\r
def __str__(self):\r
return self.name\r
\r
- @models.permalink\r
def get_absolute_url(self):\r
- return 'libraries_catalog_view', [self.slug]\r
+ return reverse('libraries_catalog_view', args=[self.slug])\r
\r
\r
class Library(models.Model):\r
"""Represent a single library in the libraries dictionary"""\r
\r
- name = models.CharField(_('name'), max_length=120, blank=True)\r
- slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True, null=True)\r
+ name = models.CharField('nazwa', max_length=120, blank=True)\r
+ slug = models.SlugField('slug', max_length=120, unique=True, db_index=True, null=True)\r
catalog = models.ForeignKey(Catalog, null=False, related_name='libraries', on_delete=models.PROTECT)\r
- url = models.CharField(_('url'), max_length=120, blank=True)\r
- description = models.TextField(_('description'), blank=True)\r
+ url = models.CharField('url', max_length=120, blank=True)\r
+ description = models.TextField('opis', blank=True)\r
\r
class Meta:\r
- verbose_name = _('library')\r
- verbose_name_plural = _('libraries')\r
+ verbose_name = 'biblioteka'\r
+ verbose_name_plural = 'biblioteki'\r
\r
def __str__(self):\r
return self.name\r
\r
- @models.permalink\r
def get_absolute_url(self):\r
- return ('libraries_library_view', [self.catalog.slug, self.slug])\r
+ return reverse('libraries_library_view', args=[self.catalog.slug, self.slug])\r