On zondag 8 juli 2018 13:58:33 CEST Derek wrote:
> I am attempting to pass multiple keyword arguments from a reverse() call
> (from my app called `uploads`).
There's no call to reverse in your code. But to do this:
reverse('upload_details', kwargs={'view': 'site', 'mid', 3})
> *urls.py*
>
> urlpatterns = [
> url(
> regex=r'^add/$',
> view=views.add_new,
> name='add_new'),
> url(
> regex=r'^details/(?P<view>[a-z.]+)/(?P<mid>\d+)?$',
> view=views.upload_details,
> name='upload_details'),
> ]
>
> *views.py*
>
> def add_new(request)
> # ... process data via a form; create a result object
> return HttpResponseRedirect(
> reverse('uploads:upload_details',
> kwargs={'view': view, 'mid':result.pk})
> )
>
> def upload_details(request, view='site', mid=None):
> # ... run process based on view and mid args
>
>
> When the `upload_details` view gets called, the 'mid' does not set (even
> though it has a valid integer value); examining the
> contrib/auth/decorators.py file in debug mode:
>
> def decorator(view_func):
> @wraps(view_func, assigned=available_attrs(view_func))
> def _wrapped_view(request, *args, **kwargs):
> if test_func(request.user):
> return view_func(request, *args, **kwargs)
And how is that relevant as well? I think you're missing some code in your
copy, cause this decorator also is not in your view code.
--
Melvyn Sopacua
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/3786925.Ha4mB3saOt%40fritzbook.
For more options, visit https://groups.google.com/d/optout.