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 myproject.stockphoto.models import Photo

class Article(models.Model):
    title = models.CharField(maxlength=200, unique=True)
    slug = models.SlugField(prepopulate_from=['title'])
    body = models.TextField()
    picture = models.ForeignKey(Photo, blank=True,null=True)


In the Admin, everything works fine and dandy. When adding new
Articles, I can either point them at existing pictures, or add new
pictures.

And instances of 'Article' do what you would expect.

Instances of 'Photo' do not though. I *should* be able to do something like:

>>> x = Photo.objects.all()[0]
>>> articles = x.article_set.all()

(I want to be able to find all the articles a given picture has been used in).

This is decidedly not working. The reason being is that my instances
of Photo *never* have an 'article_set' attribute.

The only reason I can guess is that because the two models are defined
in separate applications.

Am I missing something here?

Jay P.

PS. An interesting (and perhaps related) sidenote: In my
INSTALLED_APPS, I *have* to have the 'stockphoto' app appear before
the 'articles' app, otherwise I get the following when trying to
import 'Article' in IPython:

ImportError: No module named model

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

Reply via email to