Opened 8 years ago

Closed 8 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
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 Changed 8 years ago by Jörg Höhle

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 Changed 8 years ago by SmileyChris

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

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