Re: Choices or lookup-tables

2005-08-29 Thread Adrian Holovaty
On 8/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > my_print = Print(paper_type=1) > print my_print.paper_type > > will print out 1. Is there a recommended pattern for printing out > "Letter"? Generally this is the pattern we've used in our own code: """ class Print(meta.Model): pape

Re: Choices or lookup-tables

2005-08-29 Thread [EMAIL PROTECTED]
Is there a recommended approach to displaying the choice text rather than integer? for instance: my_print = Print(paper_type=1) print my_print.paper_type will print out 1. Is there a recommended pattern for printing out "Letter"? I have been doing methods using a dict that I use to create the

Re: Choices or lookup-tables

2005-08-26 Thread Adrian Holovaty
On 8/26/05, Maniac <[EMAIL PROTECTED]> wrote: > What should I consider when choosing between them? I suppose choices > tuple is easier to work with when making views since Django > automatically generates for it (or am I wrong here?). On the > other hand lookup table is more flexible since I can

Choices or lookup-tables

2005-08-26 Thread Maniac
Hi! I'm creating a model 'Print' with a field 'paper_type' that would contain a value from a paper types list. As I understand I can make it two different ways: 1. Create a PaperType table and refer to it from Print with a foreign key: class PaperType: name=meta.CharField(maxlength=20)