X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/9a938c8b406ce05e3bca4a5a483d473ece9e17b0..243ac5a586da9e5abb87698306794b6cc173ded1:/src/suggest/models.py?ds=sidebyside diff --git a/src/suggest/models.py b/src/suggest/models.py index b499ee8dc..1e5f2b062 100644 --- a/src/suggest/models.py +++ b/src/suggest/models.py @@ -1,4 +1,3 @@ -# -*- 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. # @@ -7,7 +6,7 @@ from datetime import timedelta from django.db import models from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class Suggestion(models.Model): @@ -15,15 +14,15 @@ class Suggestion(models.Model): 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) + user = models.ForeignKey(User, models.SET_NULL, blank=True, null=True) class Meta: ordering = ('-created_at',) verbose_name = _('suggestion') verbose_name_plural = _('suggestions') - def __unicode__(self): - return unicode(self.created_at) + def __str__(self): + return str(self.created_at) class PublishingSuggestion(models.Model): @@ -32,7 +31,7 @@ class PublishingSuggestion(models.Model): 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) + user = models.ForeignKey(User, models.SET_NULL, blank=True, null=True) class Meta: ordering = ('-created_at',) @@ -69,5 +68,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)