Hello, I have problems with many-to-many model. Look at this please: from django.core import meta
class Model1(meta.Model): attr1 = meta.CharField(maxlength=10) class META: admin = meta.Admin() class Model2(meta.Model): attr2 = meta.ManyToManyField(Model1) class META: admin = meta.Admin() When I try to make new Model2, I get this error: >>> from django.models.test import model2s >>> b=model2s.Model2() >>> b.save() --------------------------------------------------------------------------- exceptions.AttributeError Traceback (most recent call last) /usr/home/michal/www/django-server/valmez_info/<console> /usr/local/lib/python2.4/site-packages/django/utils/functional.py in _curried(*moreargs, **morekwargs) 2 def _curried(*moreargs, **morekwargs): ----> 3 return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) 4 return _curried 5 6 class Promise: /usr/local/lib/python2.4/site-packages/django/core/meta/__init__.py in method_save(opts, self) 990 991 # First, try an UPDATE. If that doesn't update anything, do an INSERT. --> 992 pk_val = getattr(self, opts.pk.attname) 993 pk_set = bool(pk_val) 994 record_exists = True AttributeError: 'Model2' object has no attribute 'id' But if I add field to Model2 class, like: class Model2(meta.Model): something = meta.CharField(maxlength=10) attr2 = meta.ManyToManyField(Model1) class META: admin = meta.Admin() And then make the new Model2 in shell, everything works fine: >>> from django.models.test import model2s >>> b=model2s.Model2(something="foo") >>> b.save() (No errors here) Does anybody tell me what I make wrong please? Thank you for any advice Regards Michal --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---