Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit 55238a2

Browse files
authored
Django 2.0 support (#4)
* Add requirements for Django 2.0 * Prepare notes for django 2.o * Changed a thing * Had some jokers from the distant past come in and review
1 parent 805ac89 commit 55238a2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: notes/migrations/0001_initial.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.db import models, migrations
55
import django.utils.timezone
66
from django.conf import settings
7+
import django.db.models.deletion
78

89

910
class Migration(migrations.Migration):
@@ -23,8 +24,8 @@ class Migration(migrations.Migration):
2324
('content', models.TextField(verbose_name='Content')),
2425
('public', models.BooleanField(default=True, verbose_name='Public')),
2526
('object_id', models.PositiveIntegerField()),
26-
('author', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
27-
('content_type', models.ForeignKey(to='contenttypes.ContentType')),
27+
('author', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=django.db.models.deletion.CASCADE)),
28+
('content_type', models.ForeignKey(to='contenttypes.ContentType', on_delete=django.db.models.deletion.CASCADE)),
2829
],
2930
options={
3031
'verbose_name': 'Note',

Diff for: notes/models.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class Note(TimeStampedModel):
3131
"""
3232
content = models.TextField(_('Content'))
3333
public = models.BooleanField(_('Public'), default=True)
34-
author = models.ForeignKey(User, blank=True, null=True)
35-
content_type = models.ForeignKey(ContentType)
34+
author = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE)
35+
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
3636
object_id = models.PositiveIntegerField()
3737
content_object = GenericForeignKey("content_type", "object_id")
3838

0 commit comments

Comments
 (0)