Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2345 (closed defect: invalid)

Opened 10 years ago

Last modified 10 years ago

AdminController/Catwalk disable entry of primary key fields

Reported by: danielfalk Owned by:
Priority: normal Milestone:
Component: TurboGears Version: 2.0.1
Severity: normal Keywords: needs feedback, admin, catwalk, primary key, disabled
Cc:

Description

As the title says, the primary key entry is disabled. Even if the primary key column is not automatically populated via autoincrement for example. This leaves one unable to create new records at all using the admin.

Long story short: the system should check to see whether the column is auto-filled, not whether it's the pk column.

Change History

comment:1 follow-up: ↓ 2 Changed 10 years ago by Chris Arndt

  • Keywords needs feedback, added

Is this about CatWalk in TurboGears 1? If so, the ticket version is set incorrectly.

Can you provide a test case demonstrating the issue?

comment:2 in reply to: ↑ 1 Changed 10 years ago by danielfalk

Replying to Chris Arndt:

Is this about CatWalk in TurboGears 1? If so, the ticket version is set incorrectly.

No, this is Turbogears 2, and I think the AdminController? is based on Catwalk (or the other way around)

Can you provide a test case demonstrating the issue?

I'll have to make one.

comment:3 follow-up: ↓ 4 Changed 10 years ago by Chris Arndt

Ok, sorry, didn't read the ticket properly, I guess. If you can provide a test case that would be helpful.

comment:4 in reply to: ↑ 3 Changed 10 years ago by danielfalk

Replying to Chris Arndt:

Ok, sorry, didn't read the ticket properly, I guess. If you can provide a test case that would be helpful.

OK, here are the basic steps:

1) Make a model using SQLAlchemy with entity "MyEntity?" where all or part of the PK does not autoincrement. 2) Run paster setup-app development.ini and paster serve development.ini 3) Go to  http://127.0.0.1:8080/admin/ and login. Click the MyEntity? link, then click the "New" link. It will provide inputs for all the fields defined on MyEntity?. Except the PK(s) will not be editable.

For step #1, here are a couple of ways to make a PK that doesn't autoincrement:

  • PK where all or part of the PK is also a foreign key
  • Use a String/Unicode? type for the PK column

comment:5 Changed 10 years ago by jorge.vargas

  • Status changed from new to closed
  • Resolution set to invalid

This is an issue with sprox itselfs as it assumes this int autoincrement PK for SQL models. I have opened a bug report there linking to this one which has the correct issue  http://bitbucket.org/percious/sprox/issue/26/sprox-should-allow-editable-primary-keys-for-non-int-non-autoincrement

Closing this as invalid as it provides the wrong cause. It's a design limitation rather than a bug, as it is "good practice" to depend on this behavior.

Note: See TracTickets for help on using tickets.