Oh, my example was buggy also. There can not be model with only
ManyToManyField. It has to have some other fields which are saved in
the model's own table. Otherwise the sql statement raises an error.
Here is better complete example:

class OtherModel(models.Model):
    name = models.CharField(maxlength=5)

    def __repr__(self):
        return self.name

    class Admin:
        pass


class Model(models.Model):
    name = models.CharField(maxlength=5)
    other_models = models.ManyToManyField(OtherModel)

    def __repr__(self):
        return self.name

    def save(self):
        super(Model, self).save()
        f = open('test.log', 'w')
        for model in self.other_models.all():
            f.write(model.name)
        f.close()

    class Admin:
        pass


The file operation writes other_models' names only after the second
call of the save method and with old values before previous save call.

I'm not very familiar with trac, so should I open a ticket or
something? Or if someone can express the problem more clearly, I
suggest him/her to open the ticket.

--
Timo


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to