On Aug 7, 10:33 pm, Milan Andric <mand...@gmail.com> wrote: > Hello I have two apps that have foreign keys to each other. Like: > > people.models: > > class Profile(Model): > secondary_email = CharField() > > class Staff(Profile): > office = ForeignKey(Room) > > resources.models: > > class Room(Model): > name = CharField() > > class Reservation(Model): > profile = ForeignKey(Profile) > > Runserver seems to work fine but when i do ./manage.py sqlall people I > get a "Error: App with label people could not be found. Are you sure > your INSTALLED_APPS setting is correct?" error. > > Is there a way around this or do I need to rip my apps apart so I can > foreign key to my rooms model? > > Thanks, > > Milan
You don't show it, but I'm guessing that each of these models.py files have import statement that import each other. This will lead to a circular dependency which will make one of them unimportable. To avoid this, don't import them at all, in either one. In the foreign key reference, use the string format to refer to the foreign model: office = ForeignKey('resources.Room') -- DR. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---