On 9/8/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > I just tried the following in a test project; > > testproject/mytest/models.py:------------ > from django.db import models > > class Image(models.Model): > name = models.CharField(maxlength=20) > testproject/mytest2/models.py----------- > from django.db import models > from testproject.mytest.models import Image > > class Article(models.Model): > name = models.CharField (maxlength=20) > img = models.ForeignKey(Image) > > --- > > Then, add both apps to INSTALLED_APPS, sync, and in a shell: > > >from testproject.mytest.models import Image > >from testproject.mytest2.models import Article > > >img1 = Image(name='foo') > >img1.save() > > >art1 = Article(name='bar', img=img1) > >art1.save() > > >img1 = Image.objects.all()[0] > >print img1.article_set.all() > > returns [<Article: Article object>] as expected. Do you get the same result > if you use this project? > > Can you provide any more details about you application? > > The only reason I can think that you wouldn't get a _set descriptor is in > the case of a m2m relation to self.
Well, from the shell, it seems to work like a charm. It only seems to broken at the Admin level. My Photo model is here: http://svn.jayparlar.com/website/trunk/awwca/stockphoto/models.py (This is almost identical to the models.py that ships with the 'stockphoto' application) My Article model is here: http://svn.jayparlar.com/website/trunk/awwca/articles/models.py (Although for these tests today, I stripped out all the fields except 'title' and 'picture') Here's what I tried: Added a Photo and Article from the admin. In the shell, there was no 'article_set' attribute. However, staying in the shell, I created (and saved) a *new* Article instance, giving it the Picture instance that was created in the Admin. After that, I *would* have an 'article_set' attribute, that would show both the Article created in the Admin, and the one created in the shell. Jay P. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---