#35742: Apply UserAdmin add_form_template according to User model USERNAME_FIELD
-------------------------------------+-------------------------------------
Reporter: antoliny0919 | Owner: (none)
Type: New feature | Status: new
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: UserAdmin, | Triage Stage:
add_form_template | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by antoliny0919:
Old description:
> Hello!! I made a ticket because there was something ambiguous on the Add
> page of the UserAdmin model.
>
> The UserAdmin model customizes the ModelAdmin Add page with
> add_form_template variable.
> And the template used as the value for that variable is
> admin/auth/user/add_form.html.
>
> I felt this part was ambiguous in the add_form template.
>
> {{{
> ...
> {% block form_top %}
> {% if not is_popup %}
> <p>{% translate 'First, enter a username and password. Then, you’ll
> be able to edit more user options.' %}</p>
> {% else %}
> <p>{% translate "Enter a username and password." %}</p>
> {% endif %}
> {% endblock %}
> ...
> }}}
> In the UserAdmin model, when a user uses a custom user model,
> USERNAME_FIELD allows a field other than username to be used.
>
> However, in the above template, <p>{%translate 'First, enter a username
> and password. Then, you'll be able to edit more user options.'%}</p> This
> part is target at the default user provided by Django, so it is awkward
> because "username" is also seen when customizing USERNAME_FIELD using
> custom users.
>
> Is this part using a static value because it is a ModelAdmin based on the
> User model provided by Django?
>
> I added the method to the UserAdmin model and modified add_form.html to
> show the tag using the USERNAME_FIELD value.
>
> I respect the great code from the Django manager and contributors. But I
> made a ticket out of my personal opinion that the code would be more
> curious and in a better way.
>
> Thank you for reading it.
New description:
Hello!! I made a ticket because there was something ambiguous on the Add
page of the UserAdmin model.
The UserAdmin model customizes the ModelAdmin Add page with
add_form_template variable.
And the template used as the value for that variable is
admin/auth/user/add_form.html.
I felt this part was ambiguous in the add_form template.
{{{
...
{% block form_top %}
{% if not is_popup %}
<p>{% translate 'First, enter a username and password. Then, you’ll be
able to edit more user options.' %}</p>
{% else %}
<p>{% translate "Enter a username and password." %}</p>
{% endif %}
{% endblock %}
...
}}}
In the UserAdmin model, when a user uses a custom user model,
USERNAME_FIELD allows a field other than username to be used.
However, in the above template, <p>{%translate 'First, enter a username
and password. Then, you'll be able to edit more user options.'%}</p> This
part is target at the default user provided by Django, so it is awkward
because "username" is also seen when customizing USERNAME_FIELD using
custom users.
Is this part using a static value because it is a ModelAdmin based on the
User model provided by Django?
I added the method to the UserAdmin model and modified add_form.html to
show the tag using the USERNAME_FIELD value.
I respect the great code from the Django maintainer and contributors. But
I made a ticket out of my personal opinion that the code would be more
curious and in a better way.
Thank you for reading it.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/35742#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070191d1616153-f4c630ae-f680-4d1e-aabf-b096d7c2b096-000000%40eu-central-1.amazonses.com.