On Aug 31, 11:14 am, "Vadivel Kumar" <[EMAIL PROTECTED]> wrote: > I know this might sound very newbie .. its true > > How can i assign an exising record of the child table to an parent record. > For example I have two models, > > class User (models.Model): > ... all other fields ... > Tags = models.ManyToManyField(Tag) > > class Tag (models.Mode): > .. all fields .. > > The problem i am facing is whenever i create a new user and add an existing > tag object to User.Tags.add() method it creates a new record in Tag table > instead i need to just map the record with the new user. > > I know am missing a paramount thing .. what is that ?
The methods you are using, if I understand you correctly, should work. I would need to take a look at the exact code that is creating a new object to help you out. But one thing you can look at is http://www.djangoproject.com/documentation/models/many_to_many/ . It is very helpful at showing how the manytomanyfields work. If you are still having an issue, post the offending code to dpaste.com and we can take a look. Thanks, Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

