# Django post edit is not working.

**URL:** <https://forum.djangoproject.com/t/django-post-edit-is-not-working/5831>\
**Category:** Using Django\
**Created:** [December 24, 2020, 12:47am UTC](https://forum.djangoproject.com/t/django-post-edit-is-not-working/5831 "2020-12-24T00:47:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjleeon](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jjleeon/32/2687_2.png) [@jjleeon](https://forum.djangoproject.com/u/jjleeon)\
**Post date:** [December 24, 2020, 12:47am UTC](https://forum.djangoproject.com/t/django-post-edit-is-not-working/5831/1 "2020-12-24T00:47:41Z")

</div>

Hi! I use to code with flash and recently change to Django. I just start Django and having trouble with editing post. This is the code below.

post\_form.html

```auto
{% extends 'blog/base.html' %}
    {% block content %}
        <form action="/blog/{{ blog_post.pk }}/update", method="POST">
            {% csrf_token %}
            <input type='text' name='title' value='{{ blog_post.title }}'/>
            <input type='text' class='textinput' name='content' value='{{ blog_post.content }}'/>
            <input type="submit" value="Submit"/>
        </form>
    {% endblock %}

```

urls.py

```auto
urlpatterns = [
    path('admin/', admin.site.urls),
    path('blog/', index),
    path('blog/<pk>', post_detail),
    path('blog/<pk>/edit', postEdit),
    path('blog/<pk>/update', postUpdate)
]

```

veiws.py

```auto
def postEdit(request, pk):
    blog_post = Post.objects.get(id=pk)
    return render(request, 'blog/post_form.html', {'blog_post':blog_post})

def postUpdate(request, pk):
    if request.method == 'POST':
        blog_post = Post.objects.get(id=pk)
        blog_post.title = request.POST.get('title')
        blog_post.content = request.POST.get('content')
        blog_post.save

    return redirect(f'/blog/{pk}')

```

When I edit the post and press submit, it redirect to the post detail page but the post isn’t changed. What did I do wrong?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 24, 2020, 2:48am UTC](https://forum.djangoproject.com/t/django-post-edit-is-not-working/5831/2 "2020-12-24T02:48:18Z")

</div>

What you really want to do is work through the [official Django tutorial](https://docs.djangoproject.com/en/3.1/intro/tutorial01/). You’ve got a lot of code in this small example that isn’t necessary or is suboptimal. There are a lot of things that Django will do for you when [working with forms](https://docs.djangoproject.com/en/3.1/topics/forms/) that you would otherwise need to do manually. If you really want to learn Django, you’ll want to learn about all of it.

---

<div class="post-metadata">

**Author:** ![jjleeon](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jjleeon/32/2687_2.png) [@jjleeon](https://forum.djangoproject.com/u/jjleeon)\
**Post date:** [December 24, 2020, 3:19am UTC](https://forum.djangoproject.com/t/django-post-edit-is-not-working/5831/3 "2020-12-24T03:19:13Z")

</div>

I just find the problem… save() I forgot to put ()…
