On Feb 14, 6:28 am, guptha <gjango...@gmail.com> wrote:
> hi ,
> In models.py i have
>        class Customer(...)
>              bill_no=models.CharFeild(...)
>
> All i need to access the field 'bill_no' and assign a value, In
> views.py i wrote
>
>  from django.db.models.signals import post_save
>  from mypro.myapp import Customer
>
>            def after_save(sender,instance,created,**kaw):
>                      sender.bill_no='INV'+ str(sender.id)
>
>            post_save.connect(after_save,sender=Customer)
>
> i'm getting an exception as attribute bill_no and id is not found ,so
> i checked the db tables ,they are present, I suppose  i misunderstood
> the concept .Please help me to find the fault

The object being saved is 'instance', not 'sender'.
Also, don't forget to save the changes to the object after modifying
it.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to