django.contrib.comments - No reference to commented object in preview

28 views
Skip to first unread message

Tomáš Ehrlich

unread,
Jul 12, 2011, 4:42:44 PM7/12/11
to Django developers
Hi there,
why there is no reference to commented object in preview?

django/contrib/comments/views/comments.py:95
return render_to_response(
template_list, {
"comment" : form.data.get("comment", ""),
"form" : form,
"next": next,
},
RequestContext(request, {})
)

It would be nice to have "object" variable with commented object.
Views knows about it using content type and pk. Thanks to lazy
evaluations of querysets, there won't be any hits to database unless
necessary.

Thejaswi Puthraya

unread,
Jul 13, 2011, 1:22:40 AM7/13/11
to Django developers
Hi,

On Jul 13, 1:42 am, Tomáš Ehrlich <tomas.ehrl...@gmail.com> wrote:
> Hi there,
> why there is no reference to commented object in preview?
>

Any specific use-case? Specifying it can make it easier to decide.

> django/contrib/comments/views/comments.py:95
>         return render_to_response(
>             template_list, {
>                 "comment" : form.data.get("comment", ""),
>                 "form" : form,
>                 "next": next,
>             },
>             RequestContext(request, {})
>         )
>

The line of thinking was that preview would perform form-level
validation and the model-level validation (that of checking for
duplicates etc) would be done on save.

> It would be nice to have "object" variable with commented object.
> Views knows about it using content type and pk. Thanks to lazy
> evaluations of querysets, there won't be any hits to database unless
> necessary.

There would be one query, that for checking duplicate comments if the
object is sent through the context.

I think this is a valid request to open a ticket and marked as DDN so
that the core team may decide.

--
Cheers
Theju

Tomáš Ehrlich

unread,
Jul 13, 2011, 1:48:55 AM7/13/11
to Django developers
Hi there,
the reason is I want to show commented object (or some parts of it)
during preview or correcting errors. I saw this behavior on lots of
sites.

Rewriting whole method because of one line seems like overkill to me.

Ticket:
https://code.djangoproject.com/ticket/16456

On 13 čnc, 07:22, Thejaswi Puthraya <thejaswi.puthr...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages