python - How can i make a form using django.contrib.comments.forms? -



python - How can i make a form using django.contrib.comments.forms? -

this form file of django.contrib.comments.forms:

https://github.com/django/django/blob/master/django/contrib/comments/forms.py

i need create object of form , utilize in template. don't want create html form object manually in templates, want reuse contrib.comments.forms.

how can it?

something this. may need modify code depending on how want process form data.

from django.contrib.comments.forms import commentform # views.py dev my_view(request): my_obj = mymodel.objects.get(id=1) form = commentform(my_obj) homecoming render(request, 'comment-template.html', {'form': form}) # comment_template.html <form action="{% comment_form_target %}" method="post"> {% csrf token %} {{ form.as_p }} <input type="submit"> </form>

python django forms

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -