X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b2d342589a7889a3b096e7192453d53bd28eed7d..7bbeecb5dd5c5f20120f9e40e41568a3bff1caa4:/src/libraries/models.py diff --git a/src/libraries/models.py b/src/libraries/models.py index 588620f1e..07a7500be 100644 --- a/src/libraries/models.py +++ b/src/libraries/models.py @@ -1,45 +1,42 @@ -# -*- 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 _ +from django.urls import reverse class Catalog(models.Model): """Represents a dictionary of libraries""" - name = models.CharField(_('name'), max_length=120, null=False) - slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True) + name = models.CharField('nazwa', max_length=120, null=False) + slug = models.SlugField('slug', max_length=120, unique=True, db_index=True) class Meta: - verbose_name = _('catalog') - verbose_name_plural = _('catalogs') + verbose_name = 'katalog' + verbose_name_plural = 'katalogi' - def __unicode__(self): + def __str__(self): return self.name - @models.permalink def get_absolute_url(self): - return 'libraries_catalog_view', [self.slug] + return reverse('libraries_catalog_view', args=[self.slug]) class Library(models.Model): """Represent a single library in the libraries dictionary""" - name = models.CharField(_('name'), max_length=120, blank=True) - slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True, null=True) + name = models.CharField('nazwa', max_length=120, blank=True) + slug = models.SlugField('slug', max_length=120, unique=True, db_index=True, null=True) catalog = models.ForeignKey(Catalog, null=False, related_name='libraries', on_delete=models.PROTECT) - url = models.CharField(_('url'), max_length=120, blank=True) - description = models.TextField(_('description'), blank=True) + url = models.CharField('url', max_length=120, blank=True) + description = models.TextField('opis', blank=True) class Meta: - verbose_name = _('library') - verbose_name_plural = _('libraries') + verbose_name = 'biblioteka' + verbose_name_plural = 'biblioteki' - def __unicode__(self): + def __str__(self): return self.name - @models.permalink def get_absolute_url(self): - return ('libraries_library_view', [self.catalog.slug, self.slug]) + return reverse('libraries_library_view', args=[self.catalog.slug, self.slug])