Skip to content

Commit

Permalink
1.9 has been out of β for some time; clean up deprecation warnings
Browse files Browse the repository at this point in the history
I'm kind of surprised that `on_delete` is going to become
mandatory. Is it that explicit is better than ...?
  • Loading branch information
zackmdavis committed Jan 7, 2016
1 parent 979ab35 commit 4d6a2a8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
14 changes: 7 additions & 7 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def karma(self):


class Post(models.Model, VotableMixin):
author = models.ForeignKey("FinetoothUser")
author = models.ForeignKey("FinetoothUser", on_delete=models.CASCADE)
title = models.CharField(max_length=200)
content = models.TextField(
validators=[
Expand Down Expand Up @@ -55,10 +55,10 @@ class Meta:


class Comment(models.Model, VotableMixin):
commenter = models.ForeignKey("FinetoothUser")
commenter = models.ForeignKey("FinetoothUser", on_delete=models.CASCADE)
content = models.TextField()
post = models.ForeignKey("Post")
parent = models.ForeignKey("Comment", null=True)
post = models.ForeignKey("Post", on_delete=models.CASCADE)
parent = models.ForeignKey("Comment", null=True, on_delete=models.CASCADE)
published_at = models.DateTimeField(auto_now_add=True)

def __str__(self):
Expand All @@ -83,19 +83,19 @@ def vote_set(self):


class Vote(models.Model):
voter = models.ForeignKey("FinetoothUser")
voter = models.ForeignKey("FinetoothUser", on_delete=models.CASCADE)
value = models.IntegerField()
start_index = models.PositiveIntegerField()
end_index = models.PositiveIntegerField()

class PostVote(Vote):
post = models.ForeignKey("Post")
post = models.ForeignKey("Post", on_delete=models.CASCADE)

def __str__(self):
return "{} on post #{}".format(self.value, self.post.pk)

class CommentVote(Vote):
comment = models.ForeignKey("Comment")
comment = models.ForeignKey("Comment", on_delete=models.CASCADE)

def __str__(self):
return "{} on comment #{}".format(self.value, self.comment.pk)
Expand Down
4 changes: 2 additions & 2 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bleach==1.4.1
Django==1.9b1
Django==1.9.1
django-debug-toolbar==1.3
django-extensions==1.5.5
django-extensions==1.6.1
ipython==3.1.0
Markdown==2.6.1
jasmine==2.0.1
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
bleach==1.4
Django==1.8
Django==1.9.1
Markdown==2.4.1
dj-database-url==0.3.0
dj-static==0.0.6
django-extensions==1.5.5
django-extensions==1.6.1
gunicorn==19.1.1
ipython==3.1.0
psycopg2==2.5.1
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand Down

0 comments on commit 4d6a2a8

Please sign in to comment.