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

Standardize max_length globally across all models #2906

Closed
2 tasks done
jathanism opened this issue Nov 23, 2022 · 8 comments
Closed
2 tasks done

Standardize max_length globally across all models #2906

jathanism opened this issue Nov 23, 2022 · 8 comments
Assignees
Labels
ms type: housekeeping Changes to the application which do not directly impact the end user
Milestone

Comments

@jathanism
Copy link
Contributor

jathanism commented Nov 23, 2022

Proposed Changes

The max_length field varies widley. This grep catches most of it (with uniqueness counts):

$ grep -r " name = .*\models.CharField" nautobot | grep -o "max_length.*\d+" | sort -n | uniq -c
  37 max_length=100
   1 max_length=150
   1 max_length=20
   1 max_length=200
   2 max_length=255
   5 max_length=50
   7 max_length=64

Justification

This inconsistency causes recurring confusion in UX at a minimum, not to mention complicates testing and validation often enough to be a pain.

NB: This may be solved by the introduction of BasePropertiesModel or similar in #2822?

TODO

@jathanism jathanism added the type: housekeeping Changes to the application which do not directly impact the end user label Nov 23, 2022
@jathanism jathanism added this to the v2.0.0 milestone Nov 23, 2022
@bryanculver
Copy link
Member

As long as max_length goes up this shouldn't be any hard requirement to solve in 2.0. And I don't know of any places where we'd like to make this length smaller.

@bryanculver bryanculver removed this from the v2.0.0 milestone Nov 29, 2022
@bryanculver bryanculver added this to the v2.1.0 milestone Jan 9, 2023
@glennmatthews
Copy link
Contributor

Need to also make sure the form fields and serializer fields also have the correct max_length.

@glennmatthews
Copy link
Contributor

Should revisit this aspect of our data models more generally - does description need to be limited to 200 characters or should it also increase, etc.

@bryanculver
Copy link
Member

Should consider CustomFieldChoice's value as well.

@lampwins lampwins removed this from the v2.1.0 milestone Nov 3, 2023
@lampwins lampwins changed the title Standardize name field max_length globally across all models Standardize max_length globally across all models Jan 26, 2024
@lampwins
Copy link
Member

The scope will be any CharField under 255 will move to 255.

@lampwins
Copy link
Member

Probably want a constant in nautobot.core

@lampwins lampwins added this to the v2.2 milestone Jan 26, 2024
@lampwins
Copy link
Member

Will want to doublecheck forms and serializer fields

@glennmatthews
Copy link
Contributor

Implemented by #5355.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ms type: housekeeping Changes to the application which do not directly impact the end user
Projects
No open projects
Status: To Groom
Development

No branches or pull requests

6 participants