On 2/18/07, Florian Apolloner <[EMAIL PROTECTED]> wrote:
>
> 2007/2/18, Honza Kr�l <[EMAIL PROTECTED]>:
> > 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...
>
> I got something like this now:
> def save(self):
> try:
> # get the old data and save the newer one over the old
> db-entry (this will keep the id static...[for bookmarks etc, cause
> using the id as identifer in the url instead of slug]).
> old_data = Rezept.objects.get(id=self.id).__dict__
> super(Rezept, self ).save()
> # Now I create a new entry
> old_record = Rezept.objects.create( **old_data )
> old_record.is_active = False # change it to deleted
> del old_record['id'] # remove the id
> # and now I want t save it as new one (old_record). I need
> to do this without calling this save method, this would result in an
> rekursion...
> super() #and what?
super( models.Model, old_record ).save() should work here
> except:
> super(Rezept , self ).save()
>
> try and except is to check whether the record exists... I know it is
> not the same as you posted but I am trying and I am stuck (Maybe I
> need to sleep over it for a while)
>
> >
>
--
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---