Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#7880 closed (fixed)

DateField dont work with choices

Reported by: Camilo Nova Owned by: nobody
Component: contrib.admin Version: dev
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:

http://dpaste.com/66580/

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: .
URL: http://code.djangoproject.com/svn/django/trunk
Repository Root: http://code.djangoproject.com/svn
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 by anonymous, 16 years ago

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

class Cuota(models.Model):
    FECHAS = (
(datetime.date(*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)

admin.site.register(Cuota)

comment:2 by Thomas Kerpe, 16 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Thomas Kerpe, 16 years ago

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

comment:4 by Ramiro Morales, 16 years ago

Description: modified (diff)

comment:5 by Russell Keith-Magee, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

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