On 2/18/07, Florian Apolloner <[EMAIL PROTECTED]> wrote: > > I got a few questions cause it is not working (I assume I am to > silly): > > def save( self ): > > old_data = self.__class__.objects.get(pk=self.id).__dict__ > I can substitue pk with id (this is my primary...)
sure, that's exactly the same > > old_data['deleted'] = True > Mark the old_data as deleted > > self.__class__.objects.create( **old_data ) > Now create a new record with the old_data and save it (create also saves the record in db) > > super( models.Model, self ).save() > Saves what? current instance with updated fields... > > > > then when you do > > > > m = Model.objects.get(pk=42) > 42 should be self.id? no, this is just a sample code to show how you would use the feature, self is not defined here, its not inside the model's definition... > > m.some_field='somenewvalue' > The things I want to change is the submitted input of the user.... > > m.save() > > What I get is the new data through the admin form. Somehow it is not > working for me, I even don't get errors the server just hangs up... it doesn't matter where you get the data from, the snipped I posted only shows example usage, the simplest possible and one easily testable from interactive shell... I just wrote it into the email as an example of how I would go about doing something like this, I said you will have to tweak it a bit, try it in shell first and see how its behaving... > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---