Thanks i will look forward to it.

regards
Bussiere

Le vendredi 9 mars 2012 23:48:30 UTC+1, rochacbruno a écrit :
>
> in web2py's DAL there is no "save" you have only two ways to store/update 
> data and it is by using a dbset method such as .update or .insert and using 
> a update_record functions that is stored in every Row object.
>
> To do what Django does we need to have some "hooks' for that 3 events 
> (dbset.insert, dbsert.update and Row.update_record)
>
> I can see that if you extend DAL it is possible to redefine via monkey 
> patching the .insert method.
>
> But it will be very better if DAL can handle this out of the box.
>
> A suggestions is adding an "callback" in .insert method
>
> def myfunction(id):
>     .....
>
> db(db...).insert(**....., _callback=myfunction)
>
> But I dont know if it is possible...
>
> On Fri, Mar 9, 2012 at 7:34 PM, bussiere adrien <bussi...@gmail.com>wrote:
>
>> Is there a way to do that in web2py :
>> i've found only this :
>> http://russcomp.wordpress.com/2011/10/12/web2py-re-db-events-trigger/ 
>>
>> To perform action on a save ?
>>
>> class Acteur(models.Model):
>>     Pseudo = models.CharField(max_length=200,null=True,blank=True)
>>     Tag = models.ManyToManyField('tags.Tag',null=True,blank=True)
>>     FamilleTag = 
>> models.ManyToManyField('tags.FamilleTag',null=True,blank=True)
>>     Description_courte = 
>> models.CharField(max_length=200,null=True,blank=True)
>>     Description = models.CharField(max_length=400,null=True,blank=True)
>>     Texte_contenu = 
>> models.ManyToManyField('presentation.Texte_contenu',null=True,blank=True)
>>     Lien = models.ForeignKey('liens.Lien',null=True,blank=True)
>>     Note_divers = 
>> models.ManyToManyField('notes.Note_divers',null=True,blank=True)
>>     Image_Acteur = 
>> models.ManyToManyField(ImageActeur,null=True,blank=True)
>>     def ___str__(self):
>>     return self.Pseudo
>>     def __unicode__(self):
>>         return self.Pseudo
>>     def save(self, *args, **kwargs):
>>         super(Acteur, self).save(*args, **kwargs) # Call the "real" 
>> save() method.
>>         page = deepcopy(Page.objects.get(Nom="Acteur_Modele"))
>>         #page.pk = None
>>         page.Nom = self.Pseudo
>>         page.Acteurs = [self]
>>         page.ImageActeur = self.Image_Acteur
>>         page.save()
>>
>
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

Reply via email to