django POST code example

Example 1: import forms

from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User


# Create your forms here.

Example 2: django httpresponseredirect

from django.http import HttpResponseRedirect

Example 3: django update request.post

request.POST = request.POST.copy()
request.POST.update({
	"foo":"bar"
})

Example 4: django get form id from request

# html
<input type="submit" value="Reply" name ="message_frm">

# views.py
if 'message_frm' in request.POST:
    #do somethings

Example 5: request.post django

Read about request objects that your views receive: https://docs.djangoproject.com/en/dev/ref/request-response/#httprequest-objects

Also your hidden field needs a reliable name and then a value:

<input type="hidden" name="title" value="{{ source.title }}">
Then in a view:

request.POST.get("title", "")