In your case e is a QuerySet, with multiple FlattenedCategory objects.

So the proper code would be to loop through them:

{{{
for fc in e:
     fc.category_set
}}}

On 5/6/2009 10:17 AM, jrs_66 wrote:
> No...   <pre class="exception_value">'QuerySet' object has no
> attribute 'category_set'</pre>
> 
> George,
> 
> I have read the docs... MANY times... from the docs...
> 
> 'Django also creates API accessors for the "other" side of the
> relationship -- the link from the related model to the model that
> defines the relationship. For example, a Blog object b has access to a
> list of all related Entry objects via the entry_set attribute:
> b.entry_set.all().'
> 
> If you would look at my model, you will see that I'm not attempting to
> join 'backwords'... forwards, my man... please review the docs for
> more info.
> 
> This is definitely the most angry forum I've ever seen... the kicker
> is that the anger is almost always coming from the people associated
> with the django project... hmmm..
> 
> On May 6, 12:48 pm, jrs_66 <jrs...@yahoo.com> wrote:
>> Hi,
>>
>> I have 2 models...
>>
>> class Category(models.Model):
>>     name = models.CharField(max_length=255)
>>     parent = models.ForeignKey('self', null=True)
>>     has_children = models.BooleanField(default=False)
>>     language = models.ForeignKey(Language, null=False, default=1)
>>     active = models.BooleanField(default=False)
>>     priority = models.IntegerField(null=False, default=5)
>>     display_treatment = models.IntegerField(null=False, default=5)
>>     last_update = models.DateTimeField(auto_now=True)
>>
>>     def __unicode__(self):
>>         return self.name
>>
>>     class Meta:
>>         verbose_name_plural = "Categories"
>>         db_table = u'categories'
>>
>> class FlattenedCategory(models.Model):
>>     category = models.ForeignKey(Category)
>>     member_of_category = models.ForeignKey(Category,
>> related_name='memberof')
>>     language = models.ForeignKey(Language)
>>     hidden = models.IntegerField()
>>     class Meta:
>>         db_table = u'flattened_category'
>>
>> I have a Queryset...
>>
>> e = FlattenedCategory.objects.select_related('category').filter
>> (member_of_category=15)
>>
>> which works... This, however, doesn't....
>>
>> e = e.category
>>
>> How do I access the related records from the Category model?
>>
>> Thanks.
>>
>> ps... Please refrain from commenting if the best you have is 'read the
>> docs'...docs'...
> > 

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

Reply via email to