Opened 12 years ago

Closed 12 years ago

Last modified 9 years ago

#7880 closed (fixed)

DateField dont work with choices

Reported by: Camilo Nova Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

The admin interface doesnt show the choices for the 'Fecha' field

I have a model like this one:

It works before the newforms-admin branch update, but after i did the update it in the admin interface the choices doesnt work, i try to change to CharField, and it works rigth, but when i back to DateField it wont work anymore.

>>svn info
Path: .
Repository Root:
Repository UUID: bcc190cf-cafb-0310-a4f2-bffc1f526a37
Revision: 8035
Node Kind: directory
Schedule: normal
Last Changed Author: jacob
Last Changed Rev: 8035
Last Changed Date: 2008-07-21 20:15:43 -0500 (Mon, 21 Jul 2008)

Change History (6)

comment:1 Changed 12 years ago by anonymous

To make it more lasting I post the Model from the dpaste:

class Cuota(models.Model):
    FECHAS = (
(*time.strptime('2008-06-01', '%Y-%m-%d')[:3]), 'Junio 2008'),
#        ('2008-06-01', 'Junio 2008'),
#        ('2008-07-01', 'Julio 2008'),
#        ('2008-08-01', 'Agosto 2008'),
#        ('2008-09-01', 'Septiembre 2008'),
#        ('2008-10-01', 'Octubre 2008'),
#        ('2008-11-01', 'Noviembre 2008'),
#        ('2008-12-01', 'Diciembre 2008'),
    valor = models.PositiveIntegerField()
    fecha = models.DateField(choices=FECHAS, unique=True)

    def __unicode__(self):
        return u"%s" % (self.fecha)

comment:2 Changed 12 years ago by Thomas Kerpe

Triage Stage: UnreviewedAccepted

comment:3 Changed 12 years ago by Thomas Kerpe

My first suggestion was breakage by r7977 (optgroup support) which is not the case. Breakage occours since the NFA-Merge.

comment:4 Changed 12 years ago by Ramiro Morales

Description: modified (diff)

comment:5 Changed 12 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [8153]) Fixed #7880 -- Corrected the handling of fields in the admin that specify choices, so that the presence of choices overrides the decision to use a custom admin widget. This is primarily of interest to Date/Time fields. Thanks to camilonova for the report.

comment:6 Changed 9 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

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