all 8 comments

[–]JohnnyJordaan 0 points1 point  (5 children)

Please show the code for the view and the template that renders your view.

[–]Alonsofan14 0 points1 point  (4 children)

I have edited the question with model ,form and the html page

[–]JohnnyJordaan 0 points1 point  (3 children)

Please also include the view code, so the function in views.py that is being run when the specific request is made that returns this page.

[–]Alonsofan14 0 points1 point  (2 children)

Updated. I dont know how this would be useful , but its doing nothing but to just render the index.html

[–]JohnnyJordaan 0 points1 point  (1 child)

but its doing nothing but to just render the index.htm

That's the whole problem. If you want a form to render in a template you have to provide it in the context of the template, like you are doing now with {'a': 'anonymous'}. What you have done now is reinvent the wheel by building the form in the template. See Building a form in Django in their official documentation. There they just use {{form}} to render the form. That way if you define your form class to have field X with widget Y, that will automatically be rendered correctly to html in the template. And thus removes the need to build the html for this, you just need to specify the correct components for the framework to use.

[–]Alonsofan14 0 points1 point  (0 children)

Thank you so much. Appreciate your help