Edited docs/model-api.txt permalink changes from [4879]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4891 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
99fbb7b62b
commit
da1d001ce1
|
@ -1774,11 +1774,9 @@ contained a line such as::
|
|||
return ('people.views.details', [str(self.id)])
|
||||
get_absolute_url = permalink(get_absolute_url)
|
||||
|
||||
Similarly, if you had a URLconf entry that looked like::
|
||||
|
||||
Similraly, if you had a URLconf entry that looked like::
|
||||
|
||||
(r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$',
|
||||
archive_view)
|
||||
(r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', archive_view)
|
||||
|
||||
...you could reference this using ``permalink()`` as follows::
|
||||
|
||||
|
@ -1790,7 +1788,7 @@ Similraly, if you had a URLconf entry that looked like::
|
|||
get_absolute_url = permalink(get_absolute_url)
|
||||
|
||||
Notice that we specify an empty sequence for the second argument in this case,
|
||||
since we're only wanting to pass in some keyword arguments.
|
||||
because we only want to pass keyword arguments, not named arguments.
|
||||
|
||||
In this way, you're tying the model's absolute URL to the view that is used
|
||||
to display it, without repeating the URL information anywhere. You can still
|
||||
|
|
Loading…
Reference in New Issue