Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set .vUUIDField class on admin UUIDFields used as raw_id_fields #12926

Closed
wants to merge 1 commit into from

Conversation

jleclanche
Copy link
Contributor

raw_id_fields get the css class vForeignKeyRawIdAdminField, which limits
the width to roughly 9 characters.
UUIDs are often used as primary keys. This commit makes it so that UUIDs
set to be a raw_id_field in the admin also get the vUUIDField css class,
which sets a larger width which can fit 36 characters.

raw_id_fields get the css class vForeignKeyRawIdAdminField, which limits
the width to roughly 9 characters.
UUIDs are often used as primary keys. This commit makes it so that UUIDs
set to be a raw_id_field in the admin also get the vUUIDField css class,
which sets a larger width which can fit 36 characters.
Comment on lines +153 to +154
if isinstance(rel_to._meta.pk, UUIDField):
context['widget']['attrs']['class'] += ' ' + 'vUUIDField'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a test could be added to show when this class is rendered.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried adding a test for this but honestly am spending far too long on it; I'm not familiar enough with the way the test suite is rendering those admin fields.

@jacobtylerwalls
Copy link
Member

Hi -- may I ask you to fill out a ticket? Most PRs aren't noticed without one.

Base automatically changed from master to main March 9, 2021 06:21
@jleclanche
Copy link
Contributor Author

Okay. https://code.djangoproject.com/ticket/32545#ticket

@felixxm
Copy link
Member

felixxm commented Nov 29, 2021

Superseded by #15136.

@felixxm felixxm closed this Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants