#30217: Admin form for DateTimeField does should require both fields
-------------------------------------+-------------------------------------
Reporter: wKavey | Owner: nobody
Type: New | Status: new
feature |
Component: | Version: 2.1
contrib.admin | Keywords: admin field
Severity: Normal | validation
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
-------------------------------------+-------------------------------------
The default Admin form for a DateTimeField seems to be a split form, with
separate inputs for both the Date and Time segments. If one provides a
Date, but no Time, the form produces a value of 'None' and raises no
ValidationErrors.
I would expect at least a ValidationError indicating that one must provide
both a Date and a Time. There is already one thrown if no values at all
are provided.
I would imaging this could involve setting "require_all_fields=True" on
the SplitDateTimeField, however I am not sure.
Somewhat related to https://code.djangoproject.com/ticket/9721
I hit this because I have a custom validation applied in my model's
clean() method (datetime_1 <= datetime_2). This is also called in my
model's save() method (self.full_clean()). When, using the admin
interface, I only specify a Date and no Time, I get an error because one,
or both, of my datetimes are None.
--
Ticket URL: <https://code.djangoproject.com/ticket/30217>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.d951ebd0881f064d6f434e760695573d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.