On Fri, Jun 26, 2015 at 4:47 PM, Alessandro Molina <
[email protected]> wrote:

>
> however the interface only allow me to edit and delete records, not create
>> new ones. (This is true for any non auto-integer primary key, not just
>> multi column ones)
>>
>
> What do you mean regarding that it doesn't allow to create new records?
> What does it happen?
>

Ok, just saw what's your problem.
Looks like most of SPROX code is meant to work with composite primary keys
in relations, but the form generation part doesn't support composite
primary keys.

Both EditableForm and AddRecordForm actually rely on get_primary_field
method of the provider, which in case of multiple primary keys only returns
the first.
So both of them actually consider only the first field to be the primary
key and the second one as a plain field.

This leads to odd behaviours, like in case of edit you can only change the
second field of the primary key and in case of new the first field is
missing at all as it is considered to be automatically generated.

I suppose New works only if you provide a default value for both fields, as
it expects the primary key to be automatic.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to