Hallo Andreij,
On 14 November 2012 11:50, andrej burja <[email protected]> wrote:

> i've made app using wizzard
> i addes tags
> db.define_table('t_tag',
>     Field('f_game_id', type='reference t_game',
>           label=T('Game Id')),
>     Field('f_name', type='string',
>           label=T('Name')),
>     auth.signature,
>     format='%(f_game_id)s',
>     migrate=settings.migrate)
>
> db.define_table('t_tag_archive',db.t_tag,Field('current_record','reference
> t_tag',readable=False,writable=False))
>
> in controller i have crud.update
> form =
> make_taggable_eq(crud.update(db.t_game,record,onaccept=update_tags_eq))
>
> if i want to delete game, there is an error:
> <class 'psycopg2.IntegrityError'> insert or update on table "t_tag"
> violates foreign key constraint "t_tag_f_game_id_fkey" DETAIL: Key
> (f_game_id)=(699) is not present in table "t_game".
>
>
You are trying to add a tag in t_tag that is not present in t_game.
Postgresql is complaining about an absend foreign key because of that.

First add the tag to t_game before trying to use it in t_tag.

Regards
Johann

-- 



Reply via email to