Opened 11 years ago

Closed 11 years ago

#21475 closed Uncategorized (invalid)

Choices Field is not shown in UserAdmin when an special sign is in the choices

Reported by: marco.roose@… Owned by: nobody
Component: contrib.admin Version: 1.5
Severity: Normal 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

I have the following model:

# -*- coding: iso-8859-1 -*-

from django.contrib.auth.models import AbstractUser
from django.db import models


class Nutzer(AbstractUser):
    NOTREGISTERED = "NR"
    NOTPROOFED = 'NP'
    NOTPAYED = 'NPY'
    EXPERIED = "EXP"
    OK = 'OK'

    MARKETSTATUSCHOICES = (
        (NOTREGISTERED, 'Du bist nicht registriert'),
        (NOTPROOFED, 'Deine Anfrage wird geprüft'),
        (NOTPAYED, 'Wir warten auf Deine Beitragszahlung'),
        (OK, 'Du kannst tauschen'),
        (EXPERIED, 'Dein Konto wurde gesperrt')
    )
    market_status = models.CharField(choices=MARKETSTATUSCHOICES, verbose_name="Tausch-Status", max_length=30, default=NOTREGISTERED)

and a "normal" Useradmin like the one from the docs. In the Nutzer change form the "market_status" field is not rendered (but the label).

If I change the NOTPROOFED to have a description without the German Umlaut the field is rendered as expected.

Change History (2)

comment:1 by marco.roose@…, 11 years ago

I fiddled around a bit:

(NOTPROOFED, u'Deine Anfrage wird geprüft'),

does work. So it seems to be some unicode problem?

comment:2 by Tim Graham, 11 years ago

Resolution: invalid
Status: newclosed

Yes, it's an error in your app, not Django. Consider using unicode_literals.

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