Biju Biju - 8 months ago 43
Python Question

NoReverseMatch Reverse for 'profile_user' with arguments '()' and keyword arguments '{}' not found


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 =
instance.user = request.user
return redirect('profile_user')

context = {
"title": 'Edit Profile',
return render(request, 'profiles/userprofile_form.html', context)

main url there is no name space given and profile url is as follows.

url(r'^profile/(?P<username>[\w.@+-]+)$', profile_view, name='profile_user'),

Could anybody help to solve this please?


Your URL requires a named argument username. You have to give it to redirect() as keyword argument. Example:

redirect('view-name', username='joe')