DateField shouldn't be mandatory
If I have a DateField
on one of my modele, then I cannot do without passing a value to that field on resource creation / edition. If I avoid passing the date field like :
{
"@id": "./",
"http://happy-dev.fr/owl/#address": "Gare de Lyon Galerie Diderot",
"http://happy-dev.fr/owl/#city": "Paris",
"http://happy-dev.fr/owl/#crowdfunding": "",
"http://happy-dev.fr/owl/#date": "",
"http://happy-dev.fr/owl/#description": "Les grenouilles zomafites sont une espèce en voie de disparition",
"http://happy-dev.fr/owl/#end_time": "",
"http://happy-dev.fr/owl/#image": "Manifestation",
"http://happy-dev.fr/owl/#location": [
"",
"Gare de Lyon Galerie Diderot, Paris 75012, France"
],
"http://happy-dev.fr/owl/#num_of_members": "",
"http://happy-dev.fr/owl/#postcode": 75012,
"http://happy-dev.fr/owl/#start_time": "",
"http://happy-dev.fr/owl/#submit-btn": "Je créé une nouvelle action",
"http://happy-dev.fr/owl/#theme": {
"@id": "http://127.0.0.1:8000/api/actionthemes/1/"
},
"http://www.w3.org/2000/01/rdf-schema#label": "Protégeons la biodiversité",
"http://www.w3.org/2003/01/geo/wgs84_pos#lat": 48.8448057,
"http://www.w3.org/2003/01/geo/wgs84_pos#long": 2.3734794
}
... I get the following 400 :
{
"date": [
"Date has wrong format. Use one of these formats instead: YYYY-MM-DD."
],
"@context": "https://cdn.happy-dev.fr/owl/hdcontext.jsonld"
}
... even though I defined the filed as "blankable" and nullable :
date = models.DateField(blank=True, null=True, verbose_name='Date')