I was searching for solutions but i didnt find anything.
So, here is my problem.

I have models, for example:

class Photo(models.Model, helpers.AdminOptions):
    name = models.CharField(default="", null=True, blank=True,
max_length=255)

class Gallery(models.Model, helpers.AdminOptions):
    name = models.CharField(max_length=255, null=True, blank=True)
    photos = models.ManyToManyField(Photo, blank=True)

and i'm traing to override save() method for Gallery:

    def save(self):
        # some code
        super(Gallery, self).save() # we need id of new gallery
        # some code
        photo = Photo()
        photo.save()
        self.photos.add(photo) # why this doesn't work?
        self.save() # this is not working
        return self

photo = Photo() and photo.save() work fine, but i want to add new
photo to Gallery (self.photos) and here is the problem. super(Gallery,
self).save() and self.save() do not saving relations betwen Photo and
Gallery. I waste big part of my time investigating why, but i still
dont know that...

(sorry for my english).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to