#
from rest_framework import serializers
from sorl.thumbnail import default
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from club.models import Membership
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
class Migration(migrations.Migration):
('category', models.CharField(db_index=True, max_length=64, null=True, blank=True)),
('created_at', models.DateTimeField(editable=False, db_index=True)),
('deleted_at', models.DateTimeField(auto_now_add=True, db_index=True)),
- ('content_type', models.ForeignKey(to='contenttypes.ContentType')),
+ ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
],
options={
},
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
+import django.db.models.deletion
from django.conf import settings
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('complete', models.BooleanField(default=False)),
- ('book', models.ForeignKey(to='catalogue.Book')),
- ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalogue.Book')),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
-# -*- 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.
#
class Deleted(models.Model):
object_id = models.IntegerField()
slug = models.SlugField(_('slug'), max_length=120, blank=True, db_index=True)
- content_type = models.ForeignKey(ContentType)
+ content_type = models.ForeignKey(ContentType, models.CASCADE)
category = models.CharField(max_length=64, null=True, blank=True, db_index=True)
created_at = models.DateTimeField(editable=False, db_index=True)
deleted_at = models.DateTimeField(auto_now_add=True, db_index=True)
class BookUserData(models.Model):
- book = models.ForeignKey(Book)
- user = models.ForeignKey(User)
+ book = models.ForeignKey(Book, models.CASCADE)
+ user = models.ForeignKey(User, models.CASCADE)
complete = models.BooleanField(default=False)
last_changed = models.DateTimeField(auto_now=True)
key = models.CharField(max_length=KEY_SIZE)
secret = models.CharField(max_length=SECRET_SIZE)
status = models.CharField(max_length=16, choices=CONSUMER_STATES, default='pending')
- user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, related_name='consumers')
+ user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True, blank=True, related_name='consumers')
def __str__(self):
return u"Consumer %s with key %s" % (self.name, self.key)
token_type = models.IntegerField(choices=TOKEN_TYPES)
timestamp = models.IntegerField()
is_approved = models.BooleanField(default=False)
- user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, related_name='tokens')
- consumer = models.ForeignKey(Consumer)
+ user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True, blank=True, related_name='tokens')
+ consumer = models.ForeignKey(Consumer, models.CASCADE)
def __str__(self):
return u"%s Token %s for %s" % (self.get_token_type_display(), self.key, self.consumer)
-# -*- 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.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from catalogue import models
from catalogue.models import Book
from picture.models import Picture
from urllib.request import urlopen, HTTPError, URLError
- from django.core.urlresolvers import reverse
+ from django.urls import reverse
from django.contrib.sites.models import Site
domain = Site.objects.get_current().domain
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
import fnpdjango.storage
import jsonfield.fields
import catalogue.fields
('mobi_file', catalogue.fields.EbookField('mobi', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), upload_to=catalogue.models.book._mobi_upload_to, max_length=255, blank=True, verbose_name='MOBI file')),
('html_file', catalogue.fields.EbookField('html', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), upload_to=catalogue.models.book._html_upload_to, max_length=255, blank=True, verbose_name='HTML file')),
('xml_file', catalogue.fields.EbookField('xml', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), upload_to=catalogue.models.book._xml_upload_to, max_length=255, blank=True, verbose_name='XML file')),
- ('parent', models.ForeignKey(related_name='children', blank=True, to='catalogue.Book', null=True)),
+ ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='children', blank=True, to='catalogue.Book', null=True)),
],
options={
'ordering': ('sort_key',),
('uploaded_at', models.DateTimeField(auto_now_add=True, verbose_name='creation date', db_index=True)),
('extra_info', jsonfield.fields.JSONField(default={}, verbose_name='Additional information', editable=False)),
('source_sha1', models.CharField(max_length=40, null=True, editable=False, blank=True)),
- ('book', models.ForeignKey(related_name='media', to='catalogue.Book')),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='media', to='catalogue.Book')),
],
options={
'ordering': ('type', 'name'),
('text', models.TextField()),
('short_text', models.TextField(editable=False)),
('anchor', models.CharField(max_length=120)),
- ('book', models.ForeignKey(related_name='fragments', to='catalogue.Book')),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fragments', to='catalogue.Book')),
],
options={
'ordering': ('book', 'anchor'),
('wiki_link_uk', models.CharField(max_length=240, null=True, blank=True)),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='creation date', db_index=True)),
('changed_at', models.DateTimeField(auto_now=True, verbose_name='creation date', db_index=True)),
- ('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'ordering': ('sort_key',),
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('object_id', models.PositiveIntegerField(verbose_name='object id', db_index=True)),
- ('content_type', models.ForeignKey(verbose_name='content type', to='contenttypes.ContentType')),
- ('tag', models.ForeignKey(related_name='items', verbose_name='tag', to='catalogue.Tag')),
+ ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='content type', to='contenttypes.ContentType')),
+ ('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', verbose_name='tag', to='catalogue.Tag')),
],
options={
'db_table': 'catalogue_tag_relation',
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
+import django.db.models.deletion
class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('count', models.IntegerField(default=0)),
- ('book', models.OneToOneField(related_name='popularity', to='catalogue.Book')),
+ ('book', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='popularity', to='catalogue.Book')),
],
),
]
-# -*- 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.
#
import urllib
from django.conf import settings
from django.db import connection, models, transaction
-from django.db.models import permalink
import django.dispatch
from django.contrib.contenttypes.fields import GenericRelation
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _, get_language
from django.utils.deconstruct import deconstructible
import jsonfield
ebook_formats = constants.EBOOK_FORMATS
formats = ebook_formats + ['html', 'xml']
- parent = models.ForeignKey('self', blank=True, null=True, related_name='children')
+ parent = models.ForeignKey('self', models.CASCADE, blank=True, null=True, related_name='children')
ancestor = models.ManyToManyField('self', blank=True, editable=False, related_name='descendant', symmetrical=False)
cached_author = models.CharField(blank=True, max_length=240, db_index=True)
return ret
- @permalink
def get_absolute_url(self):
- return 'book_detail', [self.slug]
+ return reverse('book_detail', args=[self.slug])
def gallery_path(self):
return gallery_path(self.slug)
class BookPopularity(models.Model):
- book = models.OneToOneField(Book, related_name='popularity')
+ book = models.OneToOneField(Book, models.CASCADE, related_name='popularity')
count = models.IntegerField(default=0, db_index=True)
-# -*- 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.
#
file = models.FileField(_('file'), max_length=600, upload_to=_file_upload_to, storage=OverwriteStorage())
uploaded_at = models.DateTimeField(_('creation date'), auto_now_add=True, editable=False, db_index=True)
extra_info = jsonfield.JSONField(_('extra information'), default={}, editable=False)
- book = models.ForeignKey('Book', related_name='media')
+ book = models.ForeignKey('Book', models.CASCADE, related_name='media')
source_sha1 = models.CharField(null=True, blank=True, max_length=40, editable=False)
def __str__(self):
-# -*- 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.urls import reverse
from django.utils.translation import ugettext_lazy as _
from ssify import flush_ssi_includes
import re
except AttributeError:
return ''
- @models.permalink
def get_absolute_url(self):
- return "collection", [self.slug]
+ return reverse("collection", args=[self.slug])
def get_query(self):
slugs = self.book_slugs.split()
-# -*- 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.contrib.contenttypes.fields import GenericRelation
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from newtagging import managers
text = models.TextField()
short_text = models.TextField(editable=False)
anchor = models.CharField(max_length=120)
- book = models.ForeignKey('Book', related_name='fragments')
+ book = models.ForeignKey('Book', models.CASCADE, related_name='fragments')
objects = models.Manager()
tagged = managers.ModelTaggedItemManager(Tag)
-# -*- 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.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
-from django.db.models import permalink
from django.db.models.query import Prefetch
from django.dispatch import Signal
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from newtagging.models import TagManager, TaggedItemManager
class TagRelation(models.Model):
- tag = models.ForeignKey('Tag', verbose_name=_('tag'), related_name='items')
- content_type = models.ForeignKey(ContentType, verbose_name=_('content type'))
+ tag = models.ForeignKey('Tag', models.CASCADE, verbose_name=_('tag'), related_name='items')
+ content_type = models.ForeignKey(ContentType, models.CASCADE, verbose_name=_('content type'))
object_id = models.PositiveIntegerField(_('object id'), db_index=True)
content_object = GenericForeignKey('content_type', 'object_id')
for_books = models.BooleanField(default=False)
for_pictures = models.BooleanField(default=False)
- user = models.ForeignKey(User, blank=True, null=True)
+ user = models.ForeignKey(User, models.CASCADE, blank=True, null=True)
gazeta_link = models.CharField(blank=True, max_length=240)
culturepl_link = models.CharField(blank=True, max_length=240)
wiki_link = models.CharField(blank=True, max_length=240)
def category_plural(self):
return self.category + 's'
- @permalink
def get_absolute_url(self):
- return 'tagged_object_list', [self.url_chunk]
+ return reverse('tagged_object_list', args=[self.url_chunk])
- @permalink
def get_absolute_gallery_url(self):
- return 'tagged_object_list_gallery', [self.url_chunk]
+ return reverse('tagged_object_list_gallery', args=[self.url_chunk])
def has_description(self):
return len(self.description) > 0
from django.conf import settings
from django import template
from django.template import Node, Variable, Template, Context
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.utils.cache import add_never_cache_headers
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.template.loader import render_to_string
from django.shortcuts import get_object_or_404, render, redirect
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponsePermanentRedirect
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.db.models import Q, QuerySet
from django.contrib.auth.decorators import login_required, user_passes_test
from django.utils.http import urlquote_plus
-# -*- coding: utf-8 -*-
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from django.core.mail import send_mail, mail_managers
-from django.core.urlresolvers import reverse
from django.core.validators import validate_email
from django import forms
from django.template.loader import render_to_string
from django.template import RequestContext
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
+import django.db.models.deletion
import jsonfield.fields
migrations.AddField(
model_name='attachment',
name='contact',
- field=models.ForeignKey(to='contact.Contact'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contact.Contact'),
),
]
-# -*- coding: utf-8 -*-
import yaml
from hashlib import sha1
from django.db import models
+from django.urls import reverse
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
class Attachment(models.Model):
- contact = models.ForeignKey(Contact)
+ contact = models.ForeignKey(Contact, models.CASCADE)
tag = models.CharField(max_length=64)
file = models.FileField(upload_to='contact/attachment')
- @models.permalink
def get_absolute_url(self):
- return 'contact_attachment', [self.contact_id, self.tag]
+ return reverse('contact_attachment', args=[self.contact_id, self.tag])
__import__(app_settings.FORMS_MODULE)
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
class Migration(migrations.Migration):
('anchor', models.CharField(max_length=64)),
('html', models.TextField()),
('sort_key', models.CharField(max_length=128, db_index=True)),
- ('book', models.ForeignKey(to='catalogue.Book')),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalogue.Book')),
],
options={
'ordering': ['sort_key'],
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('anchor', models.CharField(max_length=64)),
- ('book', models.ForeignKey(to='catalogue.Book')),
- ('note', models.ForeignKey(to='dictionary.Note')),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalogue.Book')),
+ ('note', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dictionary.Note')),
],
options={
'ordering': ['book'],
-# -*- 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.
#
class NoteSource(models.Model):
"""Represents a single annotation from a book."""
- note = models.ForeignKey(Note)
- book = models.ForeignKey(Book)
+ note = models.ForeignKey(Note, models.CASCADE)
+ book = models.ForeignKey(Book, models.CASCADE)
anchor = models.CharField(max_length=64)
class Meta:
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
import django.db.models.deletion
('cover', models.ImageField(upload_to='funding/covers', verbose_name='Cover')),
('notified_near', models.DateTimeField(null=True, verbose_name='Near-end notifications sent', blank=True)),
('notified_end', models.DateTimeField(null=True, verbose_name='End notifications sent', blank=True)),
- ('book', models.ForeignKey(blank=True, to='catalogue.Book', help_text='Published book.', null=True)),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, to='catalogue.Book', help_text='Published book.', null=True)),
('poll', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, to='polls.Poll', help_text='Poll', null=True)),
],
options={
('name', models.CharField(max_length=255, verbose_name='name')),
('long_name', models.CharField(max_length=255, verbose_name='long name')),
('end_date', models.DateField(null=True, verbose_name='end date', blank=True)),
- ('offer', models.ForeignKey(verbose_name='offer', blank=True, to='funding.Offer', null=True)),
+ ('offer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='offer', blank=True, to='funding.Offer', null=True)),
],
options={
'ordering': ['-price'],
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('amount', models.DecimalField(verbose_name='amount', max_digits=10, decimal_places=2)),
('timestamp', models.DateField(verbose_name='when')),
- ('book', models.ForeignKey(to='catalogue.Book')),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalogue.Book')),
],
options={
'ordering': ['-timestamp'],
migrations.AddField(
model_name='funding',
name='offer',
- field=models.ForeignKey(verbose_name='offer', to='funding.Offer'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='offer', to='funding.Offer'),
preserve_default=True,
),
migrations.AddField(
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-07-29 12:50
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('funding', '0003_auto_20180416_1336'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='funding',
+ name='offer',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='funding.Offer', verbose_name='offer'),
+ ),
+ migrations.AlterField(
+ model_name='offer',
+ name='book',
+ field=models.ForeignKey(blank=True, help_text='Published book.', null=True, on_delete=django.db.models.deletion.PROTECT, to='catalogue.Book'),
+ ),
+ migrations.AlterField(
+ model_name='spent',
+ name='book',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='catalogue.Book'),
+ ),
+ ]
-# -*- 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 urllib.parse import urlencode
from django.conf import settings
from django.contrib.sites.models import Site
-from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from django.db import models
from django.dispatch import receiver
from django.template.loader import render_to_string
+from django.urls import reverse
from django.utils.timezone import utc
from django.utils.translation import ugettext_lazy as _, override
import getpaid
start = models.DateField(_('start'), db_index=True)
end = models.DateField(_('end'), db_index=True)
redakcja_url = models.URLField(_('redakcja URL'), blank=True)
- book = models.ForeignKey(Book, null=True, blank=True, help_text=_('Published book.'))
+ book = models.ForeignKey(Book, models.PROTECT, null=True, blank=True, help_text=_('Published book.'))
cover = models.ImageField(_('Cover'), upload_to='funding/covers')
poll = models.ForeignKey(Poll, help_text=_('Poll'), null=True, blank=True, on_delete=models.SET_NULL)
If no attached to a particular Offer, applies to all.
"""
- offer = models.ForeignKey(Offer, verbose_name=_('offer'), null=True, blank=True)
+ offer = models.ForeignKey(Offer, models.CASCADE, verbose_name=_('offer'), null=True, blank=True)
price = models.DecimalField(_('price'), decimal_places=2, max_digits=10)
name = models.CharField(_('name'), max_length=255)
long_name = models.CharField(_('long name'), max_length=255)
The payment was completed if and only if payed_at is set.
"""
- offer = models.ForeignKey(Offer, verbose_name=_('offer'))
+ offer = models.ForeignKey(Offer, models.PROTECT, verbose_name=_('offer'))
name = models.CharField(_('name'), max_length=127, blank=True)
email = models.EmailField(_('email'), blank=True, db_index=True)
amount = models.DecimalField(_('amount'), decimal_places=2, max_digits=10)
class Spent(models.Model):
""" Some of the remaining money spent on a book. """
- book = models.ForeignKey(Book)
+ book = models.ForeignKey(Book, models.PROTECT)
amount = models.DecimalField(_('amount'), decimal_places=2, max_digits=10)
timestamp = models.DateField(_('when'))
-# -*- 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.core.paginator import Paginator, InvalidPage
-from django.core.urlresolvers import reverse
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
+from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView, FormView, ListView
from getpaid.models import Payment
-# -*- 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.db import models
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
def __str__(self):
return self.title
- @models.permalink
def get_absolute_url(self):
- return 'infopage', [self.slug]
+ return reverse('infopage', args=[self.slug])
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
+import django.db.models.deletion
import jsonfield.fields
('language', models.CharField(max_length=4)),
('imprint', models.CharField(max_length=256)),
('publishing_date', models.DateField()),
- ('isbn_pool', models.ForeignKey(to='isbn.ISBNPool')),
+ ('isbn_pool', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='isbn.ISBNPool')),
],
),
]
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-07-29 12:50
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('isbn', '0004_auto_20180215_1042'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='onixrecord',
+ name='isbn_pool',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='isbn.ISBNPool'),
+ ),
+ ]
-# -*- 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.
#
class ONIXRecord(models.Model):
- isbn_pool = models.ForeignKey(ISBNPool)
+ isbn_pool = models.ForeignKey(ISBNPool, models.PROTECT)
datestamp = models.DateField(auto_now=True)
suffix = models.IntegerField()
product_form = models.CharField(max_length=4)
-# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import permission_required
-from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
from django.shortcuts import render
+from django.urls import reverse
from django.views.decorators.http import require_POST
from isbn.forms import WLISBNForm, WLConfirmForm, FNPISBNForm
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
import jsonfield.fields
from django.conf import settings
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('pickle', models.FileField(upload_to='lesmianator', verbose_name='Continuations file')),
('object_id', models.PositiveIntegerField()),
- ('content_type', models.ForeignKey(to='contenttypes.ContentType')),
+ ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
],
options={
},
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
('seen_at', models.DateTimeField(auto_now_add=True, verbose_name='last view date')),
('view_count', models.IntegerField(default=1, verbose_name='view count')),
- ('created_by', models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True)),
+ ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, null=True)),
],
options={
},
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-07-29 12:50
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('lesmianator', '0002_auto_20151221_1225'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='poem',
+ name='created_by',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
+ ),
+ ]
from django.db import models
from django.utils.timezone import utc
from django.utils.translation import ugettext_lazy as _
-from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.conf import settings
+from django.urls import reverse
from jsonfield import JSONField
from catalogue.models import Book, Tag
class Poem(models.Model):
slug = models.SlugField(_('slug'), max_length=120, db_index=True)
text = models.TextField(_('text'))
- created_by = models.ForeignKey(User, null=True)
+ created_by = models.ForeignKey(User, models.SET_NULL, null=True)
created_from = JSONField(_('extra information'), null=True, blank=True)
created_at = models.DateTimeField(_('creation date'), auto_now_add=True, editable=False)
seen_at = models.DateTimeField(_('last view date'), auto_now_add=True, editable=False)
class Continuations(models.Model):
pickle = models.FileField(_('Continuations file'), upload_to='lesmianator')
- content_type = models.ForeignKey(ContentType)
+ content_type = models.ForeignKey(ContentType, models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
-# -*- 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
#\r
from django.db import models\r
+from django.urls import reverse\r
from django.utils.translation import ugettext_lazy as _\r
\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
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
-# -*- coding: utf-8 -*-
-from django.core.urlresolvers import reverse
from django.http import Http404
from django.http.response import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from newsletter.forms import UnsubscribeForm, SubscribeForm
from urllib.parse import urljoin
from django.contrib.syndication.views import Feed
-from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
+from django.urls import reverse
from django.utils.feedgenerator import Atom1Feed
from django.conf import settings
from django.http import Http404
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
+import django.db.models.deletion
from django.conf import settings
migrations.AddField(
model_name='billingagreement',
name='plan',
- field=models.ForeignKey(to='paypal.BillingPlan'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='paypal.BillingPlan'),
),
migrations.AddField(
model_name='billingagreement',
name='user',
- field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-07-29 12:50
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('paypal', '0002_billingagreement_token'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='billingagreement',
+ name='plan',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='paypal.BillingPlan'),
+ ),
+ migrations.AlterField(
+ model_name='billingagreement',
+ name='user',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
+ ),
+ ]
-# -*- 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.
#
class BillingAgreement(models.Model):
agreement_id = models.CharField(max_length=32)
- user = models.ForeignKey(User)
- plan = models.ForeignKey(BillingPlan)
+ user = models.ForeignKey(User, models.PROTECT)
+ plan = models.ForeignKey(BillingPlan, models.PROTECT)
active = models.BooleanField(max_length=32)
token = models.CharField(max_length=32)
-# -*- 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.
#
import paypalrestsdk
import pytz
from django.contrib.sites.models import Site
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.utils import timezone
from django.conf import settings
from .models import BillingPlan, BillingAgreement
-# -*- 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
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
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
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from os.path import join
from django.conf import settings
from django.db import models, migrations
+import django.db.models.deletion
import sorl.thumbnail.fields
import jsonfield.fields
import django.core.files.storage
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('area', jsonfield.fields.JSONField(default={}, verbose_name='area', editable=False)),
('kind', models.CharField(db_index=True, max_length=10, verbose_name='form', choices=[('thing', 'thing'), ('theme', 'motif')])),
- ('picture', models.ForeignKey(related_name='areas', to='picture.Picture')),
+ ('picture', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='areas', to='picture.Picture')),
],
options={
},
-# -*- 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.db import models, transaction
import catalogue.models
-from django.db.models import permalink
from sorl.thumbnail import ImageField
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.core.files.storage import FileSystemStorage
+from django.urls import reverse
from slugify import slugify
from ssify import flush_ssi_includes
class PictureArea(models.Model):
- picture = models.ForeignKey('picture.Picture', related_name='areas')
+ picture = models.ForeignKey('picture.Picture', models.CASCADE, related_name='areas')
area = jsonfield.JSONField(_('area'), default={}, editable=False)
kind = models.CharField(
_('kind'), max_length=10, blank=False, null=False, db_index=True,
def tags_by_category(self):
return split_tags(self.tags)
- @permalink
def get_absolute_url(self):
- return 'picture_detail', [self.slug]
+ return reverse('picture_detail', args=[self.slug])
def get_initial(self):
try:
-# -*- 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.
#
import logging
from random import randint
from django import template
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.utils.cache import add_never_cache_headers
import sorl.thumbnail.default
from ssify import ssi_variable
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('content', models.TextField(verbose_name='content')),
('vote_count', models.IntegerField(default=0, verbose_name='vote count')),
- ('poll', models.ForeignKey(related_name='items', to='polls.Poll')),
+ ('poll', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='polls.Poll')),
],
options={
'verbose_name': 'vote item',
-# -*- 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.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
-from django.core.urlresolvers import reverse
+from django.urls import reverse
USED_POLLS_KEY = 'used_polls'
class PollItem(models.Model):
- poll = models.ForeignKey(Poll, related_name='items')
+ poll = models.ForeignKey(Poll, models.CASCADE, related_name='items')
content = models.TextField(_('content'))
vote_count = models.IntegerField(_('vote count'), default=0)
-# -*- 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.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, redirect, render
+from django.urls import reverse
from django.views.decorators import cache
from django.views.decorators.http import require_http_methods
-# -*- 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.contrib.auth.decorators import permission_required
-from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
from django.shortcuts import render
+from django.urls import reverse
from push.forms import NotificationForm
def notification_sent(request):
- return render(request, 'push/notification_sent.html')
\ No newline at end of file
+ return render(request, 'push/notification_sent.html')
-# -*- 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.core.urlresolvers import reverse
+from django.urls import reverse
from search.forms import SearchForm
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
class Migration(migrations.Migration):
('image_link', models.URLField(null=True, verbose_name='link', blank=True)),
('image_license', models.CharField(max_length=255, null=True, verbose_name='license name', blank=True)),
('image_license_link', models.URLField(null=True, verbose_name='license link', blank=True)),
- ('book', models.ForeignKey(verbose_name='book', blank=True, to='catalogue.Book', null=True)),
+ ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='book', blank=True, to='catalogue.Book', null=True)),
],
options={
'ordering': ('vip', 'text'),
from django.db import models
from django.conf import settings
from django.core.exceptions import ValidationError
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _, string_concat
from ssify import flush_ssi_includes
from catalogue.models import Book
class Cite(models.Model):
- book = models.ForeignKey(Book, verbose_name=_('book'), null=True, blank=True)
+ book = models.ForeignKey(Book, models.CASCADE, verbose_name=_('book'), null=True, blank=True)
text = models.TextField(_('text'), blank=True)
small = models.BooleanField(_('small'), default=False, help_text=_('Make this cite display smaller.'))
vip = models.CharField(_('VIP'), max_length=128, null=True, blank=True)
-# -*- 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.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.mail import send_mail, mail_managers
-from django.core.urlresolvers import reverse
from django.core.validators import validate_email
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
from django.conf import settings
('audiobooks', models.TextField(null=True, verbose_name='audiobooks', blank=True)),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='creation date')),
('ip', models.GenericIPAddressField(verbose_name='IP address')),
- ('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'ordering': ('-created_at',),
('description', models.TextField(verbose_name='Description', blank=True)),
('created_at', models.DateTimeField(auto_now=True, verbose_name='creation date')),
('ip', models.GenericIPAddressField(verbose_name='IP address')),
- ('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'ordering': ('-created_at',),
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.20 on 2019-07-29 12:50
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('suggest', '0002_auto_20151221_1225'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='publishingsuggestion',
+ name='user',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AlterField(
+ model_name='suggestion',
+ name='user',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
+ ),
+ ]
-# -*- 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.
#
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',)
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',)
-# -*- 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.core.urlresolvers import reverse_lazy
+from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from ajaxable.utils import AjaxableFormView
-# -*- 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 os.path import join, isfile
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.db import models
from waiter.settings import WAITER_URL, WAITER_MAX_QUEUE
from waiter.utils import check_abspath
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+import django.db.models.deletion
import getpaid.abstract_mixin
('amount_paid', models.DecimalField(default=0, verbose_name='amount paid', max_digits=20, decimal_places=4)),
('external_id', models.CharField(max_length=64, null=True, verbose_name='external id', blank=True)),
('description', models.CharField(max_length=128, null=True, verbose_name='Description', blank=True)),
- ('order', models.ForeignKey(related_name='payment', to='funding.Funding')),
+ ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment', to='funding.Funding')),
],
options={
'ordering': ('-created_on',),