added on_delete in models an migrations for django 2.0

compatibility.
This commit is contained in:
2017-12-07 22:08:47 +01:00
parent c5781246fe
commit ade2a568f7
11 changed files with 590 additions and 186 deletions

View File

@@ -4,10 +4,10 @@ import os
from ckeditor.fields import RichTextField
from django.conf import settings
from django.core.exceptions import ValidationError
from django.urls import reverse
from django.db import models
from django.db.models import Q
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.utils.timezone import now
from django.utils.translation import ugettext as _
from easy_thumbnails.fields import ThumbnailerImageField
@@ -51,7 +51,7 @@ class Event(models.Model):
"""An Event that could be a tournament, a game session, or an convention."""
name = models.CharField(_('Name'), max_length=255)
description = RichTextField(_("Description"), blank=True)
location = models.ForeignKey('Location')
location = models.ForeignKey('Location', on_delete=models.PROTECT)
start = models.DateTimeField(_('Start'))
end = models.DateTimeField(_('End'), blank=True, null=True)
url = models.URLField(_('Homepage'), blank=True)
@@ -220,13 +220,14 @@ class Photo(models.Model):
upload_to=get_upload_path,
storage=OverwriteStorage()
)
event = models.ForeignKey('events.Event')
event = models.ForeignKey('events.Event', on_delete=models.PROTECT, )
description = models.TextField(
_("Description"),
max_length=300,
blank=True
)
photographer = models.ForeignKey(settings.AUTH_USER_MODEL)
photographer = models.ForeignKey(settings.AUTH_USER_MODEL,
on_delete=models.PROTECT)
on_startpage = models.BooleanField(
_("Startpage"),
default=False,