[Answer]-Django saving form field in generic or functional view

1👍

If you need to do it with functional views, you need to check the request.POST

def SomeView(request)

    c = RequestContext(request, {})
    if request.method == 'POST' :
        form = YourForm(request.POST or None  )

        # your code here, 


       # redirect on success probably  
    else :
       # create blank form 
      form = YourForm(None)

    c[form]=form      
    return render_to_response("path/to/your/templet.html", c)          

0👍

You can get value data from request(GET or POST) – request.GET.get('value', 'default_value') or request.POST.get('value', 'default_value')

Leave a comment