Re: problem lookup function
On 11/2/05, Jeffrey E. Forcier <[EMAIL PROTECTED]> wrote: > > On Nov 2, 2005, at 10:42 AM, Joey Coleman wrote: > > from django.models.myapp import categories > category_names = [ c.category_name | c in categories.get_list() ] > > Surely you mean [c.category_name for c in categories.get_list() ] ?? :) > Oops, good catch. Too much math lately :) --joey
Re: problem lookup function
On Nov 2, 2005, at 10:42 AM, Joey Coleman wrote: from django.models.myapp import categories category_names = [ c.category_name | c in categories.get_list() ] Surely you mean [c.category_name for c in categories.get_list() ] ?? :) -- Jeffrey E. Forcier Junior Developer, Research and Development Stroz Friedberg, LLC 15 Maiden Lane, 12th Floor New York, NY 10038 [main]212-981-6540 [direct]212-981-6546 http://www.strozllc.com This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail or by telephone at 212.981.6540, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient.
Re: problem lookup function
On 11/2/05, Grigory Fateyev <[EMAIL PROTECTED]> wrote: > > Hello! > > I have myapp model: > > class Category(meta.Model): > category_name = meta.CharField(maxlength=30) > category_image = meta.ImageField(upload_to="/var/www/html/media") > > class Article(meta.Model): > category_name = meta.ForeignKey(Category) > > How to get list of category_name from class Category? > I suspect this should work when in a view (though I don't have a python interpreter handy to test it): >>> from django.models.myapp import categories >>> category_names = [ c.category_name | c in categories.get_list() ] --joey
problem lookup function
Hello! I have myapp model: class Category(meta.Model): category_name = meta.CharField(maxlength=30) category_image = meta.ImageField(upload_to="/var/www/html/media") class Article(meta.Model): category_name = meta.ForeignKey(Category) How to get list of category_name from class Category? Thanks! --