def edit_bio(request, username): person = get_object_or_404(DjangoPerson, user__username=username) if request.method == "POST": form = BioForm(request.POST) if form.is_valid(): person.bio = form.cleaned_data["bio"] person.save() return HttpResponseRedirect("/%s/" % username) else: form = BioForm(initial={"bio": person.bio}) return render(request, "edit_bio.html", {"form": form})
def edit_bio(request, username): person = get_object_or_404(DjangoPerson, user__username = username) if request.method == 'POST': form = BioForm(request.POST) if form.is_valid(): person.bio = form.cleaned_data['bio'] person.save() return redirect(reverse('user_profile', args=[username])) else: form = BioForm(initial = {'bio': person.bio}) return render(request, 'edit_bio.html', { 'form': form, })