How to generate an edit form for django comments

70 views
Skip to first unread message

Sachin Gupta

unread,
Jul 4, 2012, 2:44:33 AM7/4/12
to django-d...@googlegroups.com
Hi, 

I wanted to have a functionality to be able to edit the comments posted using the comments app (not from the admin, from the site and only for logged in users). As much as I know Django, to render an edit form we need to pass an instance of the object to the form which has to be edited like

form = SomeForm(instance=some_object)

But when I try to do the same in case of CommentForm imported from django.contrib.comments.forms, I get an error  __init__() got an unexpected keyword argument 'instance'.
When I check the comment form I find that the __init__() for the comment form is overwritten and it does not accept the `instance` argument. If the form cannot accept this argument, it means I cannot generate an edit form.

Is there any work around?

Thanks,
Sachin

Russell Keith-Magee

unread,
Jul 4, 2012, 7:46:34 PM7/4/12
to django-d...@googlegroups.com
Hi Sachin,

Django-Developers is a forum for discussing the development of Django
itself, not for general user queries. General user queries should be
posted to Django-users. You should also refrain from posting the same
question to both lists.

Yours,
Russ Magee %-)
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-developers/-/4aX7tZVf6mkJ.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-develop...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
Reply all
Reply to author
Forward
0 new messages