Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
D
Django LDP
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 20
    • Issues 20
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 5
    • Merge Requests 5
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Packages
    • Packages
    • Container Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Startin blox
  • djangoldp-packages
  • Django LDP
  • Issues
  • #145

Closed
Open
Opened Jun 18, 2019 by Alexandre@alexandre
  • Report abuse
Report abuse

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')
Edited Jun 25, 2019 by Jean-Baptiste
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
1
Labels
Doing
Assign labels
  • View project labels
Reference: startinblox/djangoldp-packages/djangoldp#145