#30217: Admin form for DateTimeField does should require both fields
-------------------------------------+-------------------------------------
Reporter: wKavey | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution: needsinfo
Keywords: admin field | Triage Stage:
validation | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by wKavey):
Hmm you're right. I think my issues are stemming from the fact that I
force a call to self.full_clean() within my model's save() method
{{{
class BasicModel(models.Model):
dt = models.DateTimeField()
def clean(self, *args, **kwargs):
super().clean(*args, **kwargs)
if self.begin_dt is None:
raise ValidationError("Cannot be None")
def save(self, *args, **kwargs):
self.full_clean()
return super().save(*args, **kwargs)
}}}
I'm unsure of why it would be calling save() before it had completed
validation of the form fields... any idea how I could work around this?
There are some pretty stringent checks I am attempting to implement before
any instance of this model is saved
--
Ticket URL: <https://code.djangoproject.com/ticket/30217#comment:2>
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/064.0d9ff855f2ca7fb045722bb04018f22a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.