Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 6, 2010 14:40:28

Q.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problem with redirect


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?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 6, 2010 15:55:40

Wayne S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problem with redirect


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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 12th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support