Re: Overriding save to create and save related entity

2012-07-26 Thread Sithembewena Lloyd Dube
Thanks guys :) On Wed, Jul 25, 2012 at 6:49 PM, Mattias Linnap wrote: > It is possible to override the save() method in a model to add > functionality: > > https://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods > > Another choice would be to register a receiver for the

Re: Overriding save to create and save related entity

2012-07-25 Thread Mattias Linnap
It is possible to override the save() method in a model to add functionality: https://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods Another choice would be to register a receiver for the pre_save or post_save signals: https://docs.djangoproject.com/en/dev/ref/models/inst

Re: Overriding save to create and save related entity

2012-07-25 Thread Nicolas Emiliani
On Wed, Jul 25, 2012 at 12:34 PM, Sithembewena Lloyd Dube wrote: > Hi all, > > I have the following code: > > class Points(models.Model): > blah blah > > class TrainingSession(models.Model): > confirmed = models.BooleanField() > points = models.ForeignKey(Points, null=True, blank

Overriding save to create and save related entity

2012-07-25 Thread Sithembewena Lloyd Dube
Hi all, I have the following code: class Points(models.Model): blah blah class TrainingSession(models.Model): confirmed = models.BooleanField() points = models.ForeignKey(Points, null=True, blank=True) When a training session is saved, if confirmed is True I wish to create and