Skip to content

Pluralized URL slugs for Custom Object Types #179

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

Merged
merged 29 commits into from
Aug 22, 2025

Conversation

bctiemann
Copy link
Contributor

Introduces verbose_name and slug fields which allow URL patterns (both for UI and API) to be pluralized, and template usages to adhere to a user-controllable pattern.

name is the "internal" lowercase model name (required)
verbose_name is the human-readable, capitalized and spaced name, optional
verbose_name_plural is the plural version of the above, optional, (templates will use verbose_name + "s" if not set)
slug is the slugified version of verbose_name_plural, with a SlugField and picker similar to that used in Sites

bctiemann and others added 25 commits August 18, 2025 14:17
Check if unique flag raise validation error if non unique data
NPL-411 raise validation error if using reserved names for fields
Revert "Check if unique flag raise validation error if non unique data"
174 fix delete of CO on detail page
Bump version to 0.2.0 in pyproject.toml
max_length=100,
unique=True,
help_text=_("Internal lowercased object name, e.g. \"vendor_policy\""),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

It says lowercased but there is no validation or conversion on this, should we enforce that?

verbose_name_plural = models.CharField(max_length=100, blank=True)
slug = models.SlugField(max_length=100, null=True, unique=True, db_index=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can add the help_text here? same comment above, do we want to enforce lowercase?

Also - do we want this auto-generated off of name (can change but gives a default)?

@arthanson arthanson merged commit ade9bed into feature Aug 22, 2025
8 checks passed
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.

3 participants