getting html form data into django class based view

11 views
Skip to first unread message

Nikunj Aggarwal

unread,
Nov 19, 2013, 9:22:02 AM11/19/13
to django...@googlegroups.com
I have created a Class view in `views.py` of the django application.

    class HelloTemplate(TemplateView):
        template_name = "index.html"
   
        def get_context_data(self, **kwargs):
            context = super(HelloTemplate, self).get_context_data(**kwargs)
            return context


Now i have a form defined in the html page:

    <form method="get">
        <input type="text" name="q">
        <input type="text" name="q1">
        <input type="submit" value="Search">
    </form>   


As you can see, i am submitting the `form` on the same page.

Now i want to get the form submitted values in my `HelloTemplate` class. means i don't want to create another class or methods(outside the existing class)

Also, i will like to send error message to the html form if data is not validated in the django.


I don't know how to do this, please help me out.
Reply all
Reply to author
Forward
0 new messages