I am still having this problem. The simple solution is to put all of the Models together, but I would prefer not to do this. I am pretty sure that I have done this before. Is this something that has broken recently in Django?
On Feb 21, 12:53 pm, Michael Newman <[EMAIL PROTECTED]> wrote: > validation meaning python manage.py validate and python manage.py > syncdb. I really don't know what is messing up other than the fact > that module has a circular load. I have no idea to fix this one. > Thanks Evert for your help. Anyone else? > > On Feb 21, 12:44 pm, Evert Rol <[EMAIL PROTECTED]> wrote: > > > > That would be true if I defined both models in the same models.py, and > > > Profile was trying to use Bookmark before it was loaded in the file. > > > Because this is an import the quotes won't work. That being said this > > > in one model works when I don't need to put a import statement in it. > > > So: > > > > profiles/models.py > > > ########### > > > > class Profile(models.Model): > > > ...bookmarks = models.ManyToManyField(Webpage, > > > related_name='bookmarks') > > > > from profiles.models import Profile > > > ...author = models.ForeignKey(Profile) > > > > ########### > > > This validates, but it's not as modular as I would like. Any other > > > ideas? > > > Sorry, my bad: I wasn't reading your previous mail properly. > > > Actually, I do this myself, but I don't apply validation. > > In fact, what kind of validation do you mean? Just trying to run the > > development server (providing everything is synced to the database), > > ie, 'Python' validation; or something along the lines of form > > validation? If the latter, perhaps importing Profile into the views.py? > > It must be similar to using contrib.auth.user and extending the user > > profile with your own class. > > Otherwise, I'm currently out of suggestions... > > > Evert > > > >>> I am a bit confused as to why it is that this gives me an error. I > > >>> hope someone could explain it to me. > > > >>> Let's say I have users with Profiles that can be connected to the > > >>> one > > >>> Web page that they can author. The other Users can bookmark that > > >>> page. > > >>> So my models look like this: > > > >>> profiles.models.py > > > >>> from bookmarks.models import Bookmark > > > >>> class Profile(models.Model): > > >>> ...bookmarks = models.ManyToManyField(Webpage) > > > >>> ################ > > >>> bookmarks.models.py > > > >>> from profiles.models import Profile > > >>> ...author = models.ForeignKey(Profile) > > > >> Michael, could this have to do with the note in this section: > > >>http://www.djangoproject.com/documentation/model-api/#many-to-one- > > >> relationships > > >> "Note, however, that you can only use strings to refer to models in > > >> the same models.py file -- you cannot use a string to reference a > > >> model in a different application, or to reference a model that has > > >> been imported from elsewhere." > > >> So try to quote 'Profile', instead of importing it. > > > >>> I get an import error when I try to validate this. I realize that > > >>> there is a little of cross referencing occurring, but I really > > >>> cannot > > >>> think of a better way to accomplish this. Any ideas? > > > >>> Thanks, Michael Newman --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---