TypeError at /profile/edit_profile/ profile_edit() missing 1 required positional argument: 'username'
Пишу социальную сеть. При попытке отредактировать профиль выходит ошибка выше. Кто-то может, пожалуйста, объяснить что не так с моим кодом?
@login_required
def profile_edit(request, username):
username = get_object_or_404(User, author=username)
if request.username != post.author:
return redirect('blog:post_detail', username)
form = PostForm(
request.POST or None,
files=request.FILES or None,
instance=post)
if form.is_valid():
form.save()
return redirect('blog:post_detail', author=username)
template = 'blog/create.html'
context = {'form': form, 'post': post}
return render(request, template, context)