You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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:
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
The text was updated successfully, but these errors were encountered: