On Mon, Dec 6, 2010 at 7:00 AM, Quetzacotl <quetzaco...@gmail.com> wrote:

> Hello, i want to make function that wraps all things related to
> comments, so there should be part that gets comments from database and
> part that checks if comment was added. Then i can simply write just
> one line of code in view where i want comments. Problem is that after
> successful comment post, view should make redirect, and as we know to
> redirect you need to return response instance. That one thing doesnt
> let me make wrap function for my comments, because i cant return
> response after post. thought I can make IF statement that checks if
> return value is response instance or not. But this is 4 lines of code
> instead of one, is there any other way?
>
> --
>

I must be missing something; why can't you return a response after a post?

When I run into a problem that doesn't appear to be easily solved, I often
check to make sure that I am not trying to combine separate pieces of logic
that shouldn't be combined.  If you have 2 different things that need to
happen that cannot normally happen together, then maybe they shouldn't be
combined.  Generally speaking, Django discourages the implementation of
business logic in the template.

Just a thought...



> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to