Opened 15 years ago

Last modified 15 years ago

#10957 closed

Inconsisten behaviour in User admin display — at Version 2

Reported by: Filip Gruszczyński Owned by: nobody
Component: Contrib apps Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Karen Tracey)

I needed to change admin site for User class from auth, because I need to make first name and last name required. I subclassed Admin class for User and changed form:

class UserChangeForm(ModelForm):
        username = RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
                help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
                error_message = _("This value must contain only letters, numbers and underscores."))
        first_name = CharField(label=_('first name'), max_length=30, required=True)
        last_name = CharField(label=_('last name'), max_length=30, required=True)
        
        class Meta:
                model = User

Without first_name and last_name fields defined, admin displays it translated into polish, with first letter capitalized, like this:

Imie
Nazwiski

With first_name and last_name fields defined, which have labels defined exactly as User model ('first name' and 'last name'), admin displays it translated, but not capitalized, like this:

imie
nazwisko

The other labels are capitalized and I would like to be consistent. Is there any way to make it consistent?

Change History (2)

comment:1 by Filip Gruszczyński, 15 years ago

I can't change the example formatting, so I repost it here:

class UserChangeForm(ModelForm):
	username = RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
		help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
		error_message = _("This value must contain only letters, numbers and underscores."))
	first_name = CharField(label=_('first name'), max_length=30, required=True)
	last_name = CharField(label=_('last name'), max_length=30, required=True)
	
	class Meta:
		model = User

comment:2 by Karen Tracey, 15 years ago

Description: modified (diff)

Fixed formatting.

Note: See TracTickets for help on using tickets.
Back to Top