[Django] #29532: Make model/app urls configurable for admin

7 views
Skip to first unread message

Django

unread,
Jun 28, 2018, 7:34:57 AM6/28/18
to django-...@googlegroups.com
#29532: Make model/app urls configurable for admin
-------------------------------------+-------------------------------------
Reporter: Ramez | Owner: nobody
Issac |
Type: New | Status: new
feature |
Component: | Version: 2.1
Uncategorized | Keywords: admin , url,
Severity: Normal | routing
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If i rely heavily on admin, i would want to configure the urls text
regarding to the app / model.
My reasons
1- it's not always i want the url to say the "technical" model name, and
maybe i just want it to be short "user friendly" name
(and i don't want to make a proxy model just for that, and that would only
solve the <model_name> part of the url)

2- This task is kinda long if one wants to customize one or two model name
urls.
One would have to override the `get_urls` and maybe find out that they may
want to override the `register` itself.

My Proposal:
I believe it can be controlled by an
- AppConfig option (say `admin_app_name`) for apps, and ,
- Model Meta option for the models (say `admin_model_name`),
Those options will be accessible from model _meta , and we would use those
options instead of the current `app_label` & `model_name` to construct the
admin urls.
And so the final url would look something like this
`admin/<admin_app_name>/<admin_model_name>/add|change|delete`

--
Ticket URL: <https://code.djangoproject.com/ticket/29532>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 28, 2018, 7:54:23 PM6/28/18
to django-...@googlegroups.com
#29532: Make model/app urls configurable for admin
-------------------------------------+-------------------------------------
Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution: wontfix
Keywords: admin , url, | Triage Stage:
routing | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => wontfix
* component: Uncategorized => contrib.admin


Comment:

I don't see this as an 80% use case that justifies adding new APIs, and I
don't like the idea of putting admin-specific options in model `Meta`.

--
Ticket URL: <https://code.djangoproject.com/ticket/29532#comment:1>

Django

unread,
Jun 29, 2018, 4:25:00 AM6/29/18
to django-...@googlegroups.com
#29532: Make model/app urls configurable for admin
-------------------------------------+-------------------------------------
Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution: wontfix
Keywords: admin , url, | Triage Stage:
routing | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ramez Issac):

If you don't like putting as admin specific option in the Meta, (and i
tend to agree) then, for this specific use, where you think it should it
go ?!

It's not that big of an api change, and maybe there are more and more uses
cases that can benefit from this.
A discussion maybe ?

--
Ticket URL: <https://code.djangoproject.com/ticket/29532#comment:2>

Django

unread,
Aug 10, 2020, 7:20:04 AM8/10/20
to django-...@googlegroups.com
#29532: Make app/model urls configurable for admin
-------------------------------------+-------------------------------------

Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:

Keywords: admin , url, | Triage Stage:
routing | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Zubair Hassan):

* status: closed => new
* cc: Zubair Hassan (added)
* version: 2.1 => master
* resolution: wontfix =>


Old description:

> If i rely heavily on admin, i would want to configure the urls text
> regarding to the app / model.
> My reasons
> 1- it's not always i want the url to say the "technical" model name, and
> maybe i just want it to be short "user friendly" name
> (and i don't want to make a proxy model just for that, and that would
> only solve the <model_name> part of the url)
>
> 2- This task is kinda long if one wants to customize one or two model
> name urls.
> One would have to override the `get_urls` and maybe find out that they
> may want to override the `register` itself.
>
> My Proposal:
> I believe it can be controlled by an
> - AppConfig option (say `admin_app_name`) for apps, and ,
> - Model Meta option for the models (say `admin_model_name`),
> Those options will be accessible from model _meta , and we would use
> those options instead of the current `app_label` & `model_name` to
> construct the admin urls.
> And so the final url would look something like this
> `admin/<admin_app_name>/<admin_model_name>/add|change|delete`

New description:

If i rely heavily on admin, i would want to configure the urls text
regarding to the app / model.
My reasons

1- it's not always i want the url to say the "technical" model name, i
just want it to be short or "user friendly" name like verbose_name of
model and app properties.


My Proposal:
I believe it can be controlled by verbose_name which is already exist on
model as well as on appConfig.
We just have to only check if verbose_name exist for model or app
otherwise default model name or app label should consider for url.
Where as the matter of spaces in verbose_name it could be replaced by
`'-'`.
think a model name is `UserCreditCardData` and we just want to show as
User Personal Data we can do this using verbose_name but what about admin
url?
it could be `admin/app-label/user-personal-data/` as compare to `admin
/app-label/usercreditcarddata/` same is the case could be for `app_label`.


And so the final url would look something like this

`admin/<app_label | verbose_name>/<model_name |
verbose_name>/add|change|delete`
Here verbose_name precede if exist on app or model.
I already implemented it for my app if it is acceptable i could do this.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29532#comment:3>

Django

unread,
Aug 10, 2020, 7:31:23 AM8/10/20
to django-...@googlegroups.com
#29532: Make model/app urls configurable for admin
-------------------------------------+-------------------------------------
Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution: wontfix
Keywords: admin , url, | Triage Stage:
routing | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

Zubair Hassan, please don't change tickets descriptions and
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#closing-tickets follow triaging guidelines with regards to
wontfix tickets.]

Django

unread,
Aug 11, 2020, 8:19:26 AM8/11/20
to django-...@googlegroups.com
#29532: Make model/app urls configurable for admin
-------------------------------------+-------------------------------------
Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution: wontfix
Keywords: admin , url, | Triage Stage:
routing | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by zubair):

Thanks felixxm, for pointing out.
I am new to contributions, and just want to add my opinion that, can we
use `verbose_name` for url generation on admin side for flexibility as on
model name and app name?

--
Ticket URL: <https://code.djangoproject.com/ticket/29532#comment:4>

Reply all
Reply to author
Forward
0 new messages