#28587: All Generic Views are loosing args when you pass args and kwargs into
urlpattern
-------------------------------------+-------------------------------------
Reporter: Adrian | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.11
Severity: Normal | Resolution:
Keywords: ListView, CBV, | Triage Stage:
generic, | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adrian):
* cc: Adrian (added)
Old description:
> When I have in my urlpatterns args and kwargs the ListView is loosing
> args (it's returning empty tuple)
>
> {{{
> url(r"^(\w+)/test1/(?P<pk>[0-9]+)/list/$", SamplesListView.as_view(),
> name='list_view'),
> }}}
>
> Simple code for my view:
>
> {{{
> class SamplesListView(ListView):
> model = Sample
> template_name = 'samples/samples_list.html'
>
> def get(self, request, project_name, *args, **kwargs):
> print("project_name", project_name)
> return super().get(self, request, project_name, *args, **kwargs)
> }}}
>
> It works ok when I pass only args or kwargs into url.
New description:
When I have in my urlpatterns args and kwargs the ListView is loosing args
(it's returning empty tuple)
{{{
url(r"^(\w+)/test1/(?P<pk>[0-9]+)/list/$", SamplesListView.as_view(),
name='list_view'),
}}}
Simple code for my view:
{{{
class SamplesListView(ListView):
model = Sample
template_name = 'samples/samples_list.html'
def get(self, request, project_name, *args, **kwargs):
print("project_name", project_name)
return super().get(self, request, project_name, *args, **kwargs)
}}}
It works ok when I pass only args or kwargs into url.
THE PROBLEM occurs in ALL generic view (CreateView, UpdateView,
DeleteVIew, ListView)
--
--
Ticket URL: <https://code.djangoproject.com/ticket/28587#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.1b94b4c7f7215bf134a437acc477a189%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.