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.
* 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>
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>
* 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>
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.]
--
Ticket URL: <https://code.djangoproject.com/ticket/29532#comment:3>
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>