Why don't you use Django signals [1] for this?

[1] http://docs.djangoproject.com/en/dev/topics/signals/

2009/11/11 NMarcu <marcu.nico...@gmail.com>

>
> Hello all,
>
>   I have a section for adding new user, on auth_user table (default
> django auth method), and work just fine. I added a trigger on that
> event, to add something in a new table and my app crashed. I got this
> error:
>
> InternalError at /operators/
>
> current transaction is aborted, commands ignored until end of
> transaction block
>
> My trigger is look like this:
>
> CREATE FUNCTION f_new_user() RETURNS trigger AS $tr_new_user$
> BEGIN
>    IF (TG_OP = 'INSERT') THEN
>        INSERT INTO operators_head (username, field, caption) SELECT
> NEW.username, NEW.username, NEW.username;
>        RETURN NEW;
>    END IF;
> END;
> $tr_new_user$ LANGUAGE plpgsql;
>
> CREATE TRIGGER tr_new_user
> AFTER INSERT ON auth_user
> FOR EACH ROW EXECUTE PROCEDURE f_new_user();
>
> Do you have any ideea what I'm doing wrong?
>
> >
>


-- 
regards,
Mihail

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