Re: How to use request.GET??

2007-07-18 Thread Jeremy Dunck

On 7/18/07, Greg <[EMAIL PROTECTED]> wrote:
> Do I have to return a HttpResponse?

Yes.  It is an error for an HTTP Request not to be given a HTTP
response in return.

In the 'if "favorite_color"' branch of your example view, simple
"return response" just before the else: clause.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: How to use request.GET??

2007-07-18 Thread Greg

Also, when I use 'http://example.com/url_to_set_colour_view/?
favorite_color=Blue' it gives me an error that says:

 'The view mysite.rugs.views.set_color didn't return an HttpResponse
object.'  Do I have to return a HttpResponse?  My view is shown
above...if the 'if' statement is true the view doesn't return
anything.

Thanks for any help


On Jul 18, 9:44 pm, Greg <[EMAIL PROTECTED]> wrote:
> I've seen other Django websites that use the ? mark at the end.  I've
> always wondered what the reason for that was.  So the only time the ?
> mark is used is to send form data?
>
> On Jul 18, 9:33 pm, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote:
>
> > On 7/19/07, SmileyChris <[EMAIL PROTECTED]> wrote:
>
> > > On Jul 19, 2:22 pm, Greg <[EMAIL PROTECTED]> wrote:
> > > > I was wondering how do I send a 'favorite_color' GET parameter?  Do I
> > > > have to use a form to do this that sends data by GET or is there
> > > > another way to do it?
>
> > >http://example.com/url_to_set_colour_view/?favorite_color=Blue
>
> > Also be sure to URL encode any characters in the paramter that require
> > it. See section 2.2 of RFC1738.
>
> >http://www.ietf.org/rfc/rfc1738.txt
> > --
> > _nimrod_a_abing_
>
> >http://abing.gotdns.com/http://www.preownedcar.com/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: How to use request.GET??

2007-07-18 Thread Greg

I've seen other Django websites that use the ? mark at the end.  I've
always wondered what the reason for that was.  So the only time the ?
mark is used is to send form data?

On Jul 18, 9:33 pm, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote:
> On 7/19/07, SmileyChris <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jul 19, 2:22 pm, Greg <[EMAIL PROTECTED]> wrote:
> > > I was wondering how do I send a 'favorite_color' GET parameter?  Do I
> > > have to use a form to do this that sends data by GET or is there
> > > another way to do it?
>
> >http://example.com/url_to_set_colour_view/?favorite_color=Blue
>
> Also be sure to URL encode any characters in the paramter that require
> it. See section 2.2 of RFC1738.
>
> http://www.ietf.org/rfc/rfc1738.txt
> --
> _nimrod_a_abing_
>
> http://abing.gotdns.com/http://www.preownedcar.com/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: How to use request.GET??

2007-07-18 Thread Nimrod A. Abing

On 7/19/07, SmileyChris <[EMAIL PROTECTED]> wrote:
>
> On Jul 19, 2:22 pm, Greg <[EMAIL PROTECTED]> wrote:
> > I was wondering how do I send a 'favorite_color' GET parameter?  Do I
> > have to use a form to do this that sends data by GET or is there
> > another way to do it?
>
> http://example.com/url_to_set_colour_view/?favorite_color=Blue

Also be sure to URL encode any characters in the paramter that require
it. See section 2.2 of RFC1738.

http://www.ietf.org/rfc/rfc1738.txt
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: How to use request.GET??

2007-07-18 Thread SmileyChris

On Jul 19, 2:22 pm, Greg <[EMAIL PROTECTED]> wrote:
> I was wondering how do I send a 'favorite_color' GET parameter?  Do I
> have to use a form to do this that sends data by GET or is there
> another way to do it?

http://example.com/url_to_set_colour_view/?favorite_color=Blue


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



How to use request.GET??

2007-07-18 Thread Greg

Hello,
I have the following function

/

def set_color(request):
if "favorite_color" in request.GET:

# Create an HttpResponse object...
response = HttpResponse("Your favorite color is now %s" % \
request.GET["favorite_color"])

# ... and set a cookie on the response
response.set_cookie("favorite_color",
request.GET["favorite_color"])

else:
return HttpResponse("You didn't give a favorite color.")

/

I was wondering how do I send a 'favorite_color' GET parameter?  Do I
have to use a form to do this that sends data by GET or is there
another way to do it?

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---