X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/f3c334d8fbb682677d059308501ea57a4c7581ee..9a0ea819fa5bfd8bce2e2500fbfc0cfcc75eff08:/src/suggest/models.py?ds=sidebyside diff --git a/src/suggest/models.py b/src/suggest/models.py index b499ee8dc..254229ef7 100644 --- a/src/suggest/models.py +++ b/src/suggest/models.py @@ -1,43 +1,41 @@ -# -*- 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. # import re from datetime import timedelta from django.db import models from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ class Suggestion(models.Model): - contact = models.CharField(_('contact'), blank=True, max_length=120) - description = models.TextField(_('description'), blank=True) - created_at = models.DateTimeField(_('creation date'), auto_now=True) - ip = models.GenericIPAddressField(_('IP address')) - user = models.ForeignKey(User, blank=True, null=True) + contact = models.CharField('kontakt', blank=True, max_length=120) + description = models.TextField('opis', blank=True) + created_at = models.DateTimeField('data utworzenia', auto_now=True) + ip = models.GenericIPAddressField('adres IP') + user = models.ForeignKey(User, models.SET_NULL, blank=True, null=True) class Meta: ordering = ('-created_at',) - verbose_name = _('suggestion') - verbose_name_plural = _('suggestions') + verbose_name = 'sugestia' + verbose_name_plural = 'sugestie' - def __unicode__(self): - return unicode(self.created_at) + def __str__(self): + return str(self.created_at) class PublishingSuggestion(models.Model): - contact = models.CharField(_('contact'), blank=True, max_length=120) - books = models.TextField(_('books'), null=True, blank=True) - audiobooks = models.TextField(_('audiobooks'), null=True, blank=True) - created_at = models.DateTimeField(_('creation date'), auto_now_add=True) - ip = models.GenericIPAddressField(_('IP address')) - user = models.ForeignKey(User, blank=True, null=True) + contact = models.CharField('kontakt', blank=True, max_length=120) + books = models.TextField('książki', null=True, blank=True) + audiobooks = models.TextField('audiobooki', null=True, blank=True) + created_at = models.DateTimeField('data utworzenia', auto_now_add=True) + ip = models.GenericIPAddressField('adres IP') + user = models.ForeignKey(User, models.SET_NULL, blank=True, null=True) class Meta: ordering = ('-created_at',) - verbose_name = _('publishing suggestion') - verbose_name_plural = _('publishing suggestions') + verbose_name = 'sugestia publikacji' + verbose_name_plural = 'sugestie publikacji' def is_spam(self): suggestion_text = (self.books or self.audiobooks).strip(' \r\n,') @@ -69,5 +67,5 @@ class PublishingSuggestion(models.Model): spam = True return spam - def __unicode__(self): - return unicode(self.created_at) + def __str__(self): + return str(self.created_at)