Changes for Django2.0

This commit is contained in:
Linmao Song 2018-01-26 15:16:28 +00:00
parent 8582114b90
commit 1a3df72038
5 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ class Migration(migrations.Migration):
('rght', models.PositiveIntegerField(editable=False, db_index=True)),
('tree_id', models.PositiveIntegerField(editable=False, db_index=True)),
('level', models.PositiveIntegerField(editable=False, db_index=True)),
('parent', models.ForeignKey(related_name='children', blank=True, to='dpaste.Snippet', null=True)),
('parent', models.ForeignKey(related_name='children', blank=True, to='dpaste.Snippet', null=True, on_delete=models.CASCADE)),
],
options={
'ordering': ('-published',),

View file

@ -3,7 +3,7 @@ from __future__ import unicode_literals
from random import SystemRandom
from django.conf import settings
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
@ -53,7 +53,7 @@ class Snippet(models.Model):
choices=EXPIRE_CHOICES, default=EXPIRE_CHOICES[0][0])
expires = models.DateTimeField(_(u'Expires'), blank=True, null=True)
view_count = models.PositiveIntegerField(_('View count'), default=0)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
parent = models.ForeignKey('self', null=True, blank=True, related_name='children', on_delete=models.CASCADE)
class Meta:
ordering = ('-published',)

View file

@ -88,7 +88,7 @@ LOGIN_REDIRECT_URL = '/'
# Templates
#==============================================================================
MIDDLEWARE_CLASSES = [
MIDDLEWARE = [
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',

View file

@ -6,7 +6,7 @@ import json
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.db.models import Count
from django.http import (Http404, HttpResponse, HttpResponseBadRequest,
HttpResponseRedirect)

View file

@ -49,7 +49,7 @@ setup(
},
include_package_data=True,
install_requires=[
'django>=1.8,<2.0',
'django>=1.8',
'pygments>=1.6',
'django-markup>=1.0',
'django-csp>=3.3',