Comments (4)
Empty string should not be valid.
For empty dates None
should be used. Is the partial date field null=True
?
from django_partial_date.
Tried again but still get an error, reproduced below with identifiying information taken out. It appears the error lies in the pareDate function when it receives a blank field.
ValidationError at /admin/pages/23/edit/
["'' is not a valid date string (YYYY, YYYY-MM, YYYY-MM-DD)"]
Request Method: GET
Request URL: http://localhost:8000/admin/pages/23/edit/?next=/admin/dialectics/journal/
Django Version: 3.1.7
Exception Type: ValidationError
Exception Value:
["'' is not a valid date string (YYYY, YYYY-MM, YYYY-MM-DD)"]
Exception Location: /wagtail-env/lib/python3.8/site-packages/partial_date/fields.py, line 105, in parseDate
Python Executable: /wagtail-env/bin/python
Python Version: 3.8.10
The field is written as ->
active_end = PartialDateField(
blank=True,
null=True,
)
If it makes any difference we are using Wagtail not pure Django.
from django_partial_date.
Please make sure that your forms or any other interface to the useris properly converting the "empty user input" to None
instead of ""
.
from django_partial_date.
I encounter the same thing and this is default Django admin page, I have to add blank=True
to make the admin page saving work, and convert empty string to None in model's save() method. It maybe more convenient if django_partial_date can ignore the empty string.
https://stackoverflow.com/a/6993885/4257237
from django_partial_date.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django_partial_date.