Hi,
I am trying to extend the comments app so that I can use an alternate
view for post_comment in some situations (i.e. posting via ajax...)
This question is probably largely down to relative python ignorance on
my part, but....
1) I have made a new app in my project and set COMMENTS_APP in
settings as per docs
2) in __init__.py I have made a new get_form_target() function which
returns the url to my new ajax_post_comment view
3) I want to reuse all the code in the existing post_comment view
function but just ask it to use a different template.
in django.contrib.comments.views.comments there is:
def post_comment(request, next=None):
... ...
return next_redirect(data, next, comment_done,
c=comment._get_pk_val())
post_comment = require_POST(post_comment)
comment_done = confirmation_view(
template = "comments/posted.html",
doc = """Display a "comment was posted" success page."""
)
So you can see, what I want to do is change the value of comment_done
from my ajax_post_comment view, then maybe call the existing
post_comment view function.
I can't work out how to do this though, and it's looking like I will
have to just copy and paste the existing view code into my new view.
Is there some way to import post_comment and comment_done into my new
views.py such that I can actually affect the value of comment_done
used by the post_comment function?
Any help with my DRY headache much appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---