Opened 17 years ago

Closed 17 years ago

#4742 closed (invalid)

Admin app insists on DateField input despite null=True

Reported by: Jörg Höhle <Joerg-Cyril.Hoehle@…> Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
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

Hi,

The admin application does not seem to honour nullable Date (or DateTime) fields.
Here's a tiny test case for within the tutorial's poll application:

class Bugs(models.Model):
    suspend = models.DateField(null=True)
    name    = models.CharField(maxlength=30)

    class Admin:
        pass

The SQL looks good (postgresql):

id      | integer               | not null default nextval('polls_bugs_id_seq'::regclass)
suspend | date                  |
name    | character varying(30) | not null

The error says (in German) "suspend: This field is required.", with or w/o Javascript enabled.
Using SVN from 2007-06-29.
At the API-level, there's no trouble. Bugs(name="foo").save() works.

I've observed the same error for nullable foreign key references. I should submit a distinct bug item.

Regards,

Jörg Höhle

Change History (2)

comment:1 by Jörg Höhle, 17 years ago

I'm sorry. I had looked at #2214 before posting but not understood its embedded 'blank' hint. When I add blank=True to my date fields, empty input (which translates to NULL) is accepted in the date.

I'll have to check whether my foreignKey(null=True) issue can be solved likewise.

Regards,

Jörg Höhle.

comment:2 by Chris Beaven, 17 years ago

Resolution: invalid
Status: newclosed

This ticket is invalid, however this is a common confusion (and why I opened #3328).

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