On 3/12/07, dchandek <[EMAIL PROTECTED]> wrote:
> Am I missing something?
It's not that 'permalink' doesn't work with generic views -- it can.
As I understand it, the problem is a URLConf like this:
urlpatterns = patterns('django.views.generic.list_detail',
(r'^foo/(?P<id>\d+)/$', 'object_detail', { 'queryset': Foo.objects.all() }),
(r'^bar/(?P<id>\d+)/$', 'object_detail', { 'queryset': Bar.objects.all() }),
)
The 'get_absolute_url' methods for the 'Foo' and 'Bar' models will
probably be identical:
def get_absolute_url(self):
return ('django.views.generic.list_detail.object_detail', (), {
'id': str(self.id) })
get_absolute_url = permalink(get_absolute_url)
And this is where we get into trouble: we've got two distinct URL
patterns which point to the same view with the same argument signature
(django.views.generic.list_detail.object_detail(id=self.id)). As far
as I know, we currently only return the first matching URL, so in this
case 'get_absolute_url' for both 'Foo' and 'Bar' will return a
'/foo/<id>/' URL, because that's the first one it finds that matches.
I *think* that so long as you don't have multiple URLs pointing at the
same generic view you'll be OK, but otherwise there could be issues --
we're working on it.
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---