Re: How to pass values between views/templates

2009-10-05 Thread Bill Freeman

On Fri, Oct 2, 2009 at 9:16 PM, adelaide_mike
 wrote:
>
> Hi
> In my app the user needs to drill down through a series of templates
> and their views to identify a house.  We start with the city, then the
> street and finally the house, in each case chosen from a rendering of
> the possible values selected from the relevant database table.
>
> I have all this working nicely using request.session['insert value
> here'] as the tool for storing the choices as they are made.
>
> My question is: is there a better or more proper way?
>
> Mike

Mike,

The primary disadvantage of storing navigation state in the session,
or, for that mater,
in variables sent in a POST, is that, for example, a user emailing the
url to their spouse
("Hey, honey, look at this one!") isn't going to work.  If you are
concerned about long
urls, you could always compress them and then uuencode the value and
use that in the
url.  Better probably would be just use a database primary key for the url part.

Bill

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to pass values between views/templates

2009-10-02 Thread Shawn Milochik

Remember that people often represent their best work, and I bet they  
only answer the questions they're most confident about their  
experience with.

If you care that much about your code, you'll be fine -- once you have  
your 10,000 hours* in as a coder, people will be in awe of your code  
too.

Shawn


*See "Outliers" by Malcom Gladwell 

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to pass values between views/templates

2009-10-02 Thread adelaide_mike

My only dissatisfaction is that other contributors to this list seem
to do almost anything with very few lines of code, whereas I am using
many.  And, being a newbie I naturally worry that I am on the wrong
pathway, having missed the turning.
Thanks to both for your reassurance.

Mike

On Oct 3, 11:59 am, Shawn Milochik  wrote:
> Your current approach makes sense. If you're concerned that you're  
> storing too much data in the session, you could just maintain a  
> session ID in the session and use that as a key for an sqlite3  
> database or something, or even a model in your app's database, if that  
> makes sense. Is there any reason you're unsatisfied with the way  
> you're doing it?
>
> Shawn
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to pass values between views/templates

2009-10-02 Thread Shawn Milochik

Your current approach makes sense. If you're concerned that you're  
storing too much data in the session, you could just maintain a  
session ID in the session and use that as a key for an sqlite3  
database or something, or even a model in your app's database, if that  
makes sense. Is there any reason you're unsatisfied with the way  
you're doing it?

Shawn

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to pass values between views/templates

2009-10-02 Thread djfis...@gmail.com

Mike,

I think you're doing it right. Unless you want that data to be in the
URL (perhaps) or sent page to page in post data (probably a bad idea)
sessions are your best option.

-David

On Oct 2, 6:16 pm, adelaide_mike  wrote:
> Hi
> In my app the user needs to drill down through a series of templates
> and their views to identify a house.  We start with the city, then the
> street and finally the house, in each case chosen from a rendering of
> the possible values selected from the relevant database table.
>
> I have all this working nicely using request.session['insert value
> here'] as the tool for storing the choices as they are made.
>
> My question is: is there a better or more proper way?
>
> Mike
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to pass values between views/templates

2009-10-02 Thread adelaide_mike

Hi
In my app the user needs to drill down through a series of templates
and their views to identify a house.  We start with the city, then the
street and finally the house, in each case chosen from a rendering of
the possible values selected from the relevant database table.

I have all this working nicely using request.session['insert value
here'] as the tool for storing the choices as they are made.

My question is: is there a better or more proper way?

Mike
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---