Re: Backwards relation (ie XXX_set) across apps

2006-09-11 Thread Jay Parlar
On 9/12/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 9/10/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > I've created a patch (http://code.djangoproject.com/ticket/2684) that > > mentions all of this. > > The ticket now has a patch to solve the problem. This was a nasty > little edge c

Re: Backwards relation (ie XXX_set) across apps

2006-09-11 Thread Russell Keith-Magee
On 9/10/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > I've created a patch (http://code.djangoproject.com/ticket/2684) that > mentions all of this. The ticket now has a patch to solve the problem. This was a nasty little edge case; details attached to the patch. Ordinarily, I would just commit the

Re: Backwards relation (ie XXX_set) across apps

2006-09-09 Thread Jay Parlar
On 9/9/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > I've found the problem. > > Create an Article and Photo object in the admin view. Then, the following in > the shell: > > >>> from testproject.mytest.models import Photo > >>> Photo.objects.all()[0].article_set.all() > throws Attribute Er

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Russell Keith-Magee
On 9/9/06, Jay Parlar <[EMAIL PROTECTED]> wrote: I'll keep playing with it. This really *feels* like I've just screwedup something somewhere. I'll update if I find a solution.I've found the problem.Create an Article and Photo object in the admin view. Then, the following in the shell: >>> from test

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Jay Parlar
On 9/8/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > > > On 9/9/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > > > Because 'stockphoto' appears before 'articles' in INSTALLED_APPS, > > could it be preventing the ORM from seeing the 'Article' model? > > > No - like I said before, this block

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Russell Keith-Magee
On 9/8/06, Jay Parlar <[EMAIL PROTECTED]> wrote: Here's what I tried: Added a Photo and Article from the admin. In theshell, there was no 'article_set' attribute.Ok; I tried your models, and I got the same result. I'll look into this a little more and see if I can isolate the exact problem. Yours,

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Russell Keith-Magee
On 9/9/06, Jay Parlar <[EMAIL PROTECTED]> wrote: Because 'stockphoto' appears before 'articles' in INSTALLED_APPS,could it be preventing the ORM from seeing the 'Article' model?No - like I said before, this block of documentation is just describing the reason that stockphoto needs to be defined in

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Jay Parlar
On 9/9/06, Steven Armstrong <[EMAIL PROTECTED]> wrote: > > I had a similar problem recently. It turned out to have something to do > with the blank=True and null=True arguments. > > picture = models.ForeignKey(Photo, blank=True,null=True) > > Maybe, for testing, try removing those and see it the a

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Jay Parlar
I wonder if this is somehow related. From the db_api documentation, in the "How are the backward relationships possible?" section, it states: "The answer lies in the INSTALLED_APPS setting. The first time any model is loaded, Django iterates over every model in INSTALLED_APPS and creates the bac

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Steven Armstrong
On 09/08/06 16:33, Jay Parlar wrote: > 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(maxleng

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Jay Parlar
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

Re: Backwards relation (ie XXX_set) across apps

2006-09-08 Thread Russell Keith-Magee
On 9/7/06, Jay Parlar <[EMAIL PROTECTED]> wrote: The only reason I can guess is that because the two models are definedin separate applications. Am I missing something here?I just tried the following in a test project; testproject/mytest/models.py:from django.db import modelsclass Image

Backwards relation (ie XXX_set) across apps

2006-09-06 Thread Jay Parlar
In my project, I have a photo gallery app (stockphoto, to be precise), as well as an 'articles' app. The basic layout is that in the photo gallery app, I have: class Photo(models.Model): image = models.ImageField(...) etc. etc. In the 'articles' app, I have the following: from myprojec