> So then I changed how I did it to this model, to try and enforce the > "a profile can have many images and a picture can only have 1 > UserProfile" restraint above: > > ---[ myproj.profile.models ]--- > from myproj.myapp.models import ImageObject > > class UserProfile(models.Model): > profile_image = models.ForeignKey(ImageObject, related_name='profile_image') > ---------------------------------------- > > ---[ myproj.content.models ]--- > class ImageObject(models.Model): > name = models.CharField() > uri = models.ImageField() > user = models.ForeignKey(UserProfile) > > class VideoObject(models.Model): > name = models.CharField() > uri = models.FileField() > user = models.ForeignKey(UserProfile) > > class URLObject(models.Model): > name = models.CharField() > uri = models.URLField() > user = models.ForeignKey(UserProfile) > ---------------------------------------- > > However, at this point I'm getting errors in th dev-server and they > models disappear from the administrative interface: > > --- > Validating models... > stoneward_intranet.profile: cannot import name UserProfile > stoneward_intranet.content: cannot import name ImageObject > 2 errors found. > --- > > I get the same errors from the shell and I'm wondering if this has > something to do with each model importing the other and it running > into some sort of loop? Am I taking the fundamentally wrong approach > or do I need to work around this behavior? > > thanks! > > Clint
I'd personally go with the second model, if you can resolve the errors. I use ForeignKey for all my one-to-many relationships... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---