python - NoReverseMatch Reverse for 'profile_user' with arguments '()' and keyword arguments '{}' not found -
views.py
@login_required def profile_edit(request): profile, created = userprofile.objects.get_or_create(user=request.user) form = userprofileform(request.post or none, request.files or none, instance=profile) if form.is_valid(): instance = form.save(commit=false) instance.user = request.user instance.save() return redirect('profile_user') context = { "title": 'edit profile', "form":form, } return render(request, 'profiles/userprofile_form.html', context)
main url there no name space given , profile url follows.
url(r'^profile/(?p<username>[\w.@+-]+)$', profile_view, name='profile_user'),
could solve please?
your url requires named argument username
. have give redirect()
keyword argument. example:
redirect('view-name', username='joe')
Comments
Post a Comment