The problem I have is that I want to use a view (rather not modifing it) to show all person in a group.
The problem is I don’t know how to use the pk in the regex to filter in the same line…
I wanted something like:
url(r'^groups/(?P<pk>\d+)/$', login_required(MyListView.as_view(model=Person, queryset=Person.objects.filter(groups__id=pk))), name='person_group_list'),
With this I get:
“NameError at /clients/
name ‘pk’ is not defined”
Any hint?
You really need to write a view. That’s the advantage of class based views, you can simply inherit from MyListView. (I know you said you didn’t want to do this, but it really is the right way to go).
As a side note, I would change pk to group_pk in your regex to avoid any possible conflicts.