Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@models.permalink deprecated #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions source/chapter3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ I would choose the latter because it is more general. To do this, change your Pa
.. sourcecode:: python

from django.db import models

from django.urls import reverse

class Paste(models.Model):
text = models.TextField()
Expand All @@ -651,9 +651,8 @@ I would choose the latter because it is more general. To do this, change your Pa
def __str__(self):
return self.name or str(self.id)

@models.permalink
def get_absolute_url(self):
return ('pastebin_paste_detail', [self.id])
return reverse('pastebin_paste_detail', args=[self.id])



Expand Down
3 changes: 2 additions & 1 deletion source/chapter4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ We have already seen how to create and integrate an app into our project, so I w
from django.template.defaultfilters import slugify

from django.contrib.auth.models import User
from django.urls import reverse

class Post(models.Model):
title = models.CharField(max_length=100)
Expand All @@ -208,7 +209,7 @@ We have already seen how to create and integrate an app into our project, so I w
def __str__(self):
return self.title

@models.permalink

def get_absolute_url(self):
return ('blog_post_detail', (),
{
Expand Down