New Feature discussion: making admin app & model url configurable

66 views
Skip to first unread message

Ramez Ashraf

unread,
Jun 29, 2018, 5:49:26 AM6/29/18
to Django developers (Contributions to Django itself)
Hello guys, 

I use the admin quite extensively in my work with Django, and it's awesome.
One place that can use some polish is the urls.
As you know, the admin urls evolve around are the <app_label> /  <model_name> , and those two can get technical, long and in short not user friendly.
Hence, I propose a new feature of making those urls configurable

First of all, what do you think ? Would you benefit from this new feature? and mainly i'm asking devs with extensive use of the admin.

Now for the technical part:
The idea was initially is to state those configuration around the AppConfig (for the app part of the url) and in the model meta (for the model part)
I got a review from Tim, that he don't like the idea of the meta, and i can kinda agree with his point, and so, where do you suggest stating this configuration?

Another idea that cross my mind now, is to state those configuration in the `settings.py`, something like this 

ADMIN_URLS = {
    'apps': {
        'celery_queue_tools': 'cool-app-name'
    }, 
    'models': {
       'mylongmodelname': 'user-friendly'
    }
}

This is just another idea of where to write the url customization configuration, all is up for discussion.

Thank you all and awaiting your feedback.




kny...@knyg.ht

unread,
Jun 29, 2018, 8:57:27 AM6/29/18
to Django developers (Contributions to Django itself)
Personally, I'm not sure I see that much value. As I see it, the admin is intended for technical users, not as a general admin interface for end users (in this context I'm mostly talking about non-programmers). While it can and I sometimes do allow end-users to use the admin directly, I really feel like it's not the intended use.

I'm also not really sure what modifying the URLs would achieve, since users aren't likely to be typing them in directly, anyway.

Tom

Collin Anderson

unread,
Jun 29, 2018, 10:07:22 AM6/29/18
to django-d...@googlegroups.com
Maybe we could make an AdminSite.get_urls_for_model(self, model, model_admin)


--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/d6c3b94e-3bcd-49b5-b1b5-1c93c381ec11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ramez Ashraf

unread,
Jun 29, 2018, 10:24:23 AM6/29/18
to django-d...@googlegroups.com
Sure that's a great idea Colin !

I'm little greedy, I wanted to make it little easier, ie without needing to subclass the AdminSite... But that's absolutely great implementation too!

You received this message because you are subscribed to a topic in the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/H8y6_HOKU2o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-develop...@googlegroups.com.

To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.

Ramez Ashraf

unread,
Jun 29, 2018, 11:09:27 AM6/29/18
to django-d...@googlegroups.com
Another comment, if i may, about the implementation after some thoughts

1- it does not customize the app_index url 
2- as a consequence, the "uniformity" the admin urls may be broken
So maybe there is a way, that this method `get_urls_for_model` get changed to include both the app_index, and the models customization ?

Finally, taking the app_index url into account,it would suggest that this method lives on the AdminSite (not in the ModelAdmin)

Thank you so much for your appreciated cooperation Collin


--
Ramez Ashraf
Co-Founder and lead developer Ra Systems

Ramez Ashraf

unread,
Jun 29, 2018, 1:04:37 PM6/29/18
to django-d...@googlegroups.com
Taking it off from Collin's crucial suggestion
https://github.com/django/django/pull/10111

Implement it as an AdminSite method, Which, after some thoughts, i think it's fair that if one wants to customize the admin urls, then they should sub class the AdminSite, 
Also i believe for developers relying "heavily" on the admin (those who will actually use of this feature), they already did sub class AdminSite for one reason or the other.


Reply all
Reply to author
Forward
0 new messages