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

Reply via email to