Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#7880 closed (fixed)

DateField dont work with choices

Reported by: camilonova 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: UI/UX:

Description (last modified by ramiro)

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)

Attachments (0)

Change History (6)

comment:1 Changed 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 6 years ago by toke

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 6 years ago by toke

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

comment:4 Changed 6 years ago by ramiro

  • Description modified (diff)

comment:5 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 3 years ago by jacob

  • milestone 1.0 beta deleted

Milestone 1.0 beta deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.