views:

59

answers:

1

the docs says:

post_save
django.db.models.signals.post_save

created
A boolean; True if a -new- record was create.

and I have this:

from django.db.models.signals import post_save
def handle_new_user(sender, instance, created, **kwargs):
    print "--------> save() "+str(created)
post_save.connect(handle_new_user, sender=User)

when I do in shell:

u = User(username="cat")
u.save()
>>> --------> save() True
u.username = "dog"
u.save()
>>> --------> save() True

I expect a >>> --------> save() False when I save() the second time because is an update? not?

A: 

Seems like you have implemented your own User which doesn't have a unique constraint on username?

Lakshman Prasad
Im implementing "from django.contrib.auth.models import User"
panchicore