Closed metakot closed 1 year ago
Ah, yes - that's a good idea. Like you say, we could add something to TableConfig
.
@metakot Even if you hide the primary key in TableConfig
, you can edit and delete a record from the record dropdown menu.
@sinisaos That's a good point - I didn't think of that.
I think it would be cool if the user could specify which column is the link. Depends how tricky it is.
@dantownsend We already have a nice edit and delete dropdown (even for a hidden field) and I think that's enough. Honestly, I don't know how to provide a link for a field that we don't render in template. https://github.com/piccolo-orm/piccolo_admin/blob/a90ccf1f784696f3bc94a743ca38976542015b2c/admin_ui/src/views/RowListing.vue#L426-L430
@sinisaos I think what we'd do is imagine it's a User
table. They can hide the id
column, and make the name
column the link (the name
would have to be visible, otherwise it wouldn't work).
@dantownsend But crud operations are based on the primary key of the record and you need to provide that primary key (as hidden field) to the column you want to make as link. As you wish, but I think what we had now is enough.
@sinisaos Ah, good point.
Well, django has that. If the field is hidden it doesn't mean that it isn't involved in crud operations. The UUID primary key is just ugly but a lot of people using it.
@metakot Yes, you are right about Django. We could try to do something similar so that the first visible column is always a crud link, whether it's the primary key or some other column. I will try to do something during the day.
Actually, in order to achieve this, we need a small code change so that if the primary key is hidden, we use the first visible column as crud link.
@dantownsend and @metakot if you agree with this I can make a PR.
Yeah, the first visible one is alright!
This is fixed in v0.43.0
https://github.com/piccolo-orm/piccolo_admin/releases/tag/0.43.0
So we have an UUID primary keys and want to hide them in admin, but that's happens:
It would be cool if the record link field was parameterized in
TableConfig