hi, i wrote def after_save(sender,instance,created,**kaw): instance.acct_number ='RBSB' + str(instance.id) instance.save()
post_save.connect(after_save,sender=Selector) once when i save it gives out error like "maximum recursion depth exceeded in cmp "Exception I 'm not aware how to save back to the database ,please help Thanks guptha On Feb 14, 4:02 pm, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > 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 importpost_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 -~----------~----~----~----~------~----~------~--~---