My code is here

http://dpaste.com/88831/

It's not working I really don't know why the other part of the
post_save is not even being executed

On Wed, Nov 5, 2008 at 4:04 PM, Antoni Aloy <[EMAIL PROTECTED]> wrote:
>
> 2008/11/5 Low Kian Seong <[EMAIL PROTECTED]>:
>>
>> Dear all,
>>
>> I am using django to write an a web based sales inventory system for
>> my client. To this end, I have created two objects in my models which
>> is :
>>
>> Sales and Stock. Everytime a sales is associated with a particular
>> stock is created, I want to update the Stock object's status field as
>> 'Sold'. Asking on the #django channel, they suggested I override the
>> save method for the model which lead me to finally try out the
>> post_save signal.
>>
>> I tried out most of the examples and tried to associate my method
>> which actually will try to get the particular stock object based on
>> the foreign key entry from Sales and update that object's 'status'
>> field. This however does not work. I tried to put the
>> signals.post_save.connect method in my __init__.py file and models.py
>> file but the code is not executed. Can someone please point me to a
>> project or url which has a more complete example for using the signals
>> and post_save? It seems like a very powerful component of the django
>> architecture.
>>
>> Thank you in advance.
>
> This is an example about how to register a delete signal to save the
> deleted user to a table called Eliminat, save should be nearly the
> same.
>
> You can put the in your models file, but be sure you have the
> application model in the settings.py file.
>
> {{{
> def registra(sender, **kwargs):
>    # get the instance
>    instancia = kwargs['instance']
>    # Creates the object who's going to store the username
>    usuari = Eliminat(user=instancia.username)
>    # and the save it
>    usuari.save()
>
> pre_delete.connect(registra, sender=User)
>
> }}}
>
> Hope it helps!
>
> Best regards,
>
> --
> Antoni Aloy López
> Blog: http://trespams.com
> Site: http://apsl.net
>
> >
>



-- 
Low Kian Seong
blog: http://lowkster.blogspot.com

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to