Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 2, 2005 14:21:08

Grigory F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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

Offline

#2 Nov. 2, 2005 15:42:12

Joey C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

problem lookup function


On 11/2/05, Grigory Fateyev <> 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 =

--joey

Offline

#3 Nov. 2, 2005 15:55:00

Jeffrey E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

problem lookup function


On Nov 2, 2005, at 10:42 AM, Joey Coleman wrote:from django.models.myapp import categories
category_names = Surely you mean ?? :)


--
Jeffrey E. Forcier
Junior Developer, Research and Development
Stroz Friedberg, LLC
15 Maiden Lane, 12th Floor
New York, NY 10038
212-981-6540 212-981-6546http://www.strozllc.comThis 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.

Offline

#4 Nov. 3, 2005 09:24:27

Joey C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

problem lookup function


On 11/2/05, Jeffrey E. Forcier <> wrote:
>
> On Nov 2, 2005, at 10:42 AM, Joey Coleman wrote:
>
> >>>> from django.models.myapp import categories
> >>>> category_names =
>
> Surely you mean ?? :)
>

Oops, good catch. Too much math lately :)

--joey

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support