I'm using Django 1.8. If I'm writing an app, and I want to add 
get_absolute_url() to a model, the question is: what do I put for the first 
argument to 'reverse'?

The documentation 
at https://docs.djangoproject.com/en/1.8/topics/http/urls/#url-namespaces 
implies that I need to know two things: the instance name, and the app 
name. The problem is that get_absolute_url() knows neither of these.

Imagine my app has a urlpattern like:

    url(r'^view/(\d+)$', views.view, name="view")


I could just say reverse("view", self.id) but what if another app has a 
view called 'view'? What if my app is instanced twice - i.e. as shown in 
the docs:

    url(r'^author-polls/', include('polls.urls', namespace='author-polls', 
app_name='polls')),
    url(r'^publisher-polls/', include('polls.urls', 
namespace='publisher-polls', app_name='polls')),


?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/89ed6fcc-c37a-4d6b-b7eb-01ff5561db08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to