Hi,

I have a table that has a varchar-based primary key, which is a code supplied by the user when creating the record. Autoadmin works, except it doesn't give the user the ability to enter a key field, as the primary_key autoadmin type maps into a Form API 'value' type.

I've crafted a patch that detects non-serial primary keys and presents the user with the appropriate field type for the key type (varchar -> textfield in my case). It should also be overridable with the usual #form key.

I've added test cases (and fixed up the existing test case for the edit form, which didn't write a record before attempting to edit it) and the whole suite passes.

Thanks!

CommentFileSizeAuthor
autoadmin-nonserial.patch10.42 KBneilnz

Comments

_rune’s picture

Cool! Is on vacation the next two weeks, talk to you after!

Cheers
Rune

_rune’s picture

Assigned: Unassigned » _rune
Status: Needs review » Patch (to be ported)

Hi

Your patch looks grand, and even though non-serial PKs scares me a bit, I will commit the patch soonly with some other changes that I'm working on, namely more flexibility in the list view.

Would you like to have maintainer status of Auto Admin and do it yourself?

Cheers
Rune

_rune’s picture

After thinking a bit more on this I'm getting this sinking feeling inside. What is a good usecase for non-serial primary keys, except working with badly configured database schemas?

_rune’s picture

Status: Patch (to be ported) » Closed (fixed)

Did not hear from you, closing.
Thanks!
Rune