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

Support for alphanumeric PKs #380

Open
brente opened this issue Oct 14, 2013 · 1 comment
Open

Support for alphanumeric PKs #380

brente opened this issue Oct 14, 2013 · 1 comment

Comments

@brente
Copy link

brente commented Oct 14, 2013

The default admin url patterns (in djadmin2.types) expect the model's PK to be strictly numeric.
This is not always the case, and I think there should be an easier (and DRY) way to implement this.

Django's admin uses a generic pattern (r'^(.+)/$'), but I like the idea of restricting it for numeric PKs (faster 404s, etc.).

Whatever the final decision, the default pattern should be documented, especially if it differs from Django's standard.

How to implement support for the non-default pattern is a design choice:

  • just instruct developers on what and how to rewrite in their own ModelAdmins (get_urls, get_api_urls)
  • add some behind-the-scenes magic to automate pattern definition based on model introspection
  • make this explicit through a parameter or an intermediate class derived from ModelAdmin2
  • ...

I don't like magic, but that would allow developers to add a model to the admin without necessarily defining a ModelAdmin. This means that the best solution is probably the fourth ("...") :-)

I'm sorry if this has already or is being discussed elsewhere. I'd love to contribute to the solution, but I just started looking into django-admin2 and I'm not ready to suggest one yet.

Stefano

@auvipy
Copy link
Contributor

auvipy commented Nov 13, 2016

Hi, sorry that no one responded. please join us https://gitter.im/jazzband/django-admin2 for further discussions.

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

No branches or pull requests

2 participants