3👍
There are multiple problems I can see in the code as I can see it, above.
- First, the
def email_new_user()
is wrongly indented. If that is not a formatting error here, correct it. new_user = kwargs.["instance"]
is wrong syntax. It really should bekwargs["instance"]
And then, do you have an SMTP server running? Can you send email from the shell? If not, configure that and then try it again. It should work.
- [Django]-How many channels can Redis support for PUB/SUB?
- [Django]-Is there any built in django authentication and acl=access controll list library?
- [Django]-Django signals. how to create a unique dispatch id?
- [Django]-Python conditionally round up numbers
- [Django]-Why are my django model fields not working?
0👍
One possible problem was, Django user cretion consists of two steps. First django asks for username, password and password confirmation, and when you press save (or save and continue edit) your save method fired without e-mail information. Since django will accept that request as a newly created record, your signal will fire for a record with no e-mail information…
If django handles admin save diffrently and do not mark a newly created record instance as created you shall not have any problem, but probably django will not do that.
UPDATE: Some possible reasons are:
- You need django 1.3, so check your django version with python manage.py version and update it if required…
- Best place for your your models.py files
You can put signal handling and registration code anywhere you like. However, you’ll need to make sure that the module it’s in gets imported early on so that the signal handling gets registered before any signals need to be sent. This makes your app’s models.py a good place to put registration of signal handlers.
These are basic problems…