PS: vacancy.pk is None for some reason... I don't really understand why, since the generated SQL specifies a primary key and my code was modeled after the sample code snippets in the django documentation.
2008/6/9 Daniel Kersten <[EMAIL PROTECTED]>: > Hi again, > > I'm having a few more problems with my django code. I am trying to add > entries to a models.ManyToManyField but it's not working. > > The exception thrown is: > <class 'apps.main.models.ApplicationRequirements'> instance needs to > have a primary key value before a many-to-many relationship can be > used. > > The code which raises this exception is: > vacancy.application_requirements.add(requirement) > > The definition of application_requirements in the vacancy model is: > application_requirements = > models.ManyToManyField(ApplicationRequirements, editable=False) > > I checked the database, and both tables definitely have primary keys > (and besides, if I don't add one myself, django adds the 'id' field as > a primary key). > I'm not really sure whats causing the error or what I can do to fix it. > > Any tips would be greatly appreciated! > Dan. > > -- > Daniel Kersten. > Leveraging dynamic paradigms since the synergies of 1985. > -- Daniel Kersten. Leveraging dynamic paradigms since the synergies of 1985. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Python Ireland" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.ie/group/pythonireland?hl=en -~----------~----~----~----~------~----~------~--~---
