Re: access the state of a Model object prior to it's modification ?

2012-07-31 Thread Nicolas Emiliani
On Mon, Jul 30, 2012 at 6:22 PM, Tomas Neme wrote: > > uhm, if you register a listener to the pre_save signal, then you can do > this: > > > if instance.published: > # the instance about to be saved has the published flag on > dbojb = MyModel.objects.get(id=instance.id) > > # did it have it

Re: access the state of a Model object prior to it's modification ?

2012-07-30 Thread Tomas Neme
uhm, if you register a listener to the pre_save signal, then you can do this: if instance.published: # the instance about to be saved has the published flag on dbojb = MyModel.objects.get(id=instance.id) # did it have it on the database? if not dbobj.published: do_stuff() you probab

Re: access the state of a Model object prior to it's modification ?

2012-07-30 Thread Nicolas Emiliani
This is a long shot but try checking out django-reversion > Sounds interesting. > thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/NM3

Re: access the state of a Model object prior to it's modification ?

2012-07-30 Thread megaBos
Hello, This is a long shot but try checking out django-reversion thank you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/NM39pkUyvG4J. To post to this

Re: access the state of a Model object prior to it's modification ?

2012-07-30 Thread Melvyn Sopacua
On 15-7-2012 0:49, Nicolas Emiliani wrote: > obj.published == True > > Is there a way to know which was the state of the model, in this case the > state of obj.published, > before the user clicked on the save button on the admin form ? Set the form field of the ModelAdmin to a custom form that de

Re: access the state of a Model object prior to it's modification ?

2012-07-16 Thread Nicolas Emiliani
s nothing to do >> with that attribute ? I would be >> republishing only if it's previous state was not published. But how can I >> acces that previous state ? >> >> Sounds waky :P >> >> >> >>> On Sun, Jul 15, 2012 at 1:49 AM, Nicolas Emiliani

Re: access the state of a Model object prior to it's modification ?

2012-07-16 Thread Jani Tiainen
ied some other field that has nothing to do > with that attribute ? I would be > republishing only if it's previous state was not published. But how can I > acces that previous state ? > > Sounds waky :P > > > >> On Sun, Jul 15, 2012 at 1:49 AM, Nicolas Emili

Re: access the state of a Model object prior to it's modification ?

2012-07-15 Thread Nicolas Emiliani
wrote: > >> Hi, >> >> Is there a way to access the state of a Model object prior to it's >> modification through a form ? >> Kind of a nasty question :S, let me explain. >> >> The thing is that if i use the save_model hook and the user modifies

Re: access the state of a Model object prior to it's modification ?

2012-07-15 Thread Jani Tiainen
Hi, How about telling us what are you trying to achieve by comparing to previous state of the object? On Sun, Jul 15, 2012 at 1:49 AM, Nicolas Emiliani wrote: > Hi, > > Is there a way to access the state of a Model object prior to it's > modification through a form ? > Kind

access the state of a Model object prior to it's modification ?

2012-07-14 Thread Nicolas Emiliani
Hi, Is there a way to access the state of a Model object prior to it's modification through a form ? Kind of a nasty question :S, let me explain. The thing is that if i use the save_model hook and the user modifies the model through the form, the obj parameter that I receive has already al