RE: sending data back to template out of a function

2008-06-06 Thread Emily Rodgers
Yes, but python cares about types (a lot!!). If you have {% if blah %} in
your template, the template parser will have to evaluate blah. If blah is a
string, it will evaluate true unless it is empty. I am not totally sure how
it will be evaluated if it is not a string (or a list / dict / bool), so it
is good to know what you are trying to make it evaluate.
 
>From looking at the code you have given, it looks like the most likely
problem is with zipcode variable, or how you are calling the function.
 
Em


  _  

From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of chris hendrix
Sent: 06 June 2008 15:46
To: django-users@googlegroups.com
Subject: Re: sending data back to template out of a function


Hi Em -

I'm not really specifying anything about type @ the moment.. .i'm just
trying to figure out how to pass stuff back to the template (ie stuff that's
NOT form validation related)


BR


On Fri, Jun 6, 2008 at 10:40 AM, Emily Rodgers <[EMAIL PROTECTED]>
wrote:



I can't see anything work in your code (but there could be something I
haven't spotted!!).

My instinct would be to ensure that zipcode is a string. What did you do to
check that the zipcode is being passed in?

Em

> -Original Message-
> From: django-users@googlegroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of Bobby Roberts
> Sent: 06 June 2008 15:31
> To: Django users
> Subject: sending data back to template out of a function
>
>
> Hi all -
>
> Thanks for your continued support as I find my Django legs.
>
> on my form submission, i send to a view that checks for
> validation and for now all i want to do is send the data that
> was entered right back and show it to the user, but not in
> the form field.  I'm breaking my code out into two functions,
> one that does the form validation and one that does the
> return.  The reason is that I will be querying UPS
> information and just want a separate function to do that...
> the function passing back to the template is as such:
>
>
> def return_ziplookup(zipcode):
> zipquery = zipcode
> return render_to_response("upsratelookup.html",
> {'zipquery':zipquery})
>
> I have confirmed in fact that zipcode is getting passed in fine.
>
>
> In my template I have this:
>
> {% if zipquery %}
> Now Showing UPS Rates for zipcode {{ zipquery|escape }}
> {% else %}
> NO ZIPCODE RESULTS FOUND
> {% endif %}
>
>
> the template, on form submission always shows NO ZIPCODE
> RESULTS FOUND. Do you see anything i'm doing wrong?
>
> Thanks for helping me learn.
>
> BR
>
>
>
> >
>












--~--~-~--~~~---~--~~
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: sending data back to template out of a function

2008-06-06 Thread chris hendrix
Hi Em -

I'm not really specifying anything about type @ the moment.. .i'm just
trying to figure out how to pass stuff back to the template (ie stuff that's
NOT form validation related)


BR

On Fri, Jun 6, 2008 at 10:40 AM, Emily Rodgers <[EMAIL PROTECTED]>
wrote:

>
> I can't see anything work in your code (but there could be something I
> haven't spotted!!).
>
> My instinct would be to ensure that zipcode is a string. What did you do to
> check that the zipcode is being passed in?
>
> Em
>
> > -Original Message-
> > From: django-users@googlegroups.com
> > [mailto:[EMAIL PROTECTED] On Behalf Of Bobby Roberts
> > Sent: 06 June 2008 15:31
> > To: Django users
> > Subject: sending data back to template out of a function
> >
> >
> > Hi all -
> >
> > Thanks for your continued support as I find my Django legs.
> >
> > on my form submission, i send to a view that checks for
> > validation and for now all i want to do is send the data that
> > was entered right back and show it to the user, but not in
> > the form field.  I'm breaking my code out into two functions,
> > one that does the form validation and one that does the
> > return.  The reason is that I will be querying UPS
> > information and just want a separate function to do that...
> > the function passing back to the template is as such:
> >
> >
> > def return_ziplookup(zipcode):
> > zipquery = zipcode
> > return render_to_response("upsratelookup.html",
> > {'zipquery':zipquery})
> >
> > I have confirmed in fact that zipcode is getting passed in fine.
> >
> >
> > In my template I have this:
> >
> > {% if zipquery %}
> > Now Showing UPS Rates for zipcode {{ zipquery|escape }}
> > {% else %}
> > NO ZIPCODE RESULTS FOUND
> > {% endif %}
> >
> >
> > the template, on form submission always shows NO ZIPCODE
> > RESULTS FOUND. Do you see anything i'm doing wrong?
> >
> > Thanks for helping me learn.
> >
> > BR
> >
> >
> >
> > >
> >
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: sending data back to template out of a function

2008-06-06 Thread Emily Rodgers

 

> -Original Message-
> From: django-users@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of Emily Rodgers
> Sent: 06 June 2008 15:41
> To: django-users@googlegroups.com
> Subject: RE: sending data back to template out of a function
> 
> 
> I can't see anything work in your code (but there could be 
> something I haven't spotted!!).

I mean't to make it not work!!

Hayfever has broken my brain today :(



--~--~-~--~~~---~--~~
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: sending data back to template out of a function

2008-06-06 Thread Emily Rodgers

I can't see anything work in your code (but there could be something I
haven't spotted!!).

My instinct would be to ensure that zipcode is a string. What did you do to
check that the zipcode is being passed in?

Em

> -Original Message-
> From: django-users@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of Bobby Roberts
> Sent: 06 June 2008 15:31
> To: Django users
> Subject: sending data back to template out of a function
> 
> 
> Hi all -
> 
> Thanks for your continued support as I find my Django legs.
> 
> on my form submission, i send to a view that checks for 
> validation and for now all i want to do is send the data that 
> was entered right back and show it to the user, but not in 
> the form field.  I'm breaking my code out into two functions, 
> one that does the form validation and one that does the 
> return.  The reason is that I will be querying UPS 
> information and just want a separate function to do that... 
> the function passing back to the template is as such:
> 
> 
> def return_ziplookup(zipcode):
> zipquery = zipcode
> return render_to_response("upsratelookup.html",
> {'zipquery':zipquery})
> 
> I have confirmed in fact that zipcode is getting passed in fine.
> 
> 
> In my template I have this:
> 
> {% if zipquery %}
> Now Showing UPS Rates for zipcode {{ zipquery|escape }}
> {% else %}
> NO ZIPCODE RESULTS FOUND
> {% endif %}
> 
> 
> the template, on form submission always shows NO ZIPCODE 
> RESULTS FOUND. Do you see anything i'm doing wrong?
> 
> Thanks for helping me learn.
> 
> BR
> 
> 
> 
> > 
> 



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---