Developer guide#
This guide is for a developer building a Django project with django-partial-dates. It covers
installing the package, working with a date in Python, storing it, querying the dates it stores,
entering them in a form, showing them to a reader, filtering them with django-filter, exposing them through Django REST framework and moving
a project from django-partial-date.
Installation: install the package and add the field to a model.
Partial date values: build a
PartialDate, read its parts, sort and compare it, and ask which period it covers.Storing a partial date: save and read a value, and see what the field does with text that is not a date, with empty values and in fixtures.
Querying: filter partial dates by year, month, day or range, and find out which uncertain dates each filter includes.
Entering a partial date: use the form field in a model form, the admin or a plain form, name the years it offers, and learn what the user sees and what each error means.
Showing a partial date: get the text a reader sees, at the precision it was recorded and in the active language, from a template, from Python and in the admin.
Filtering with django-filter: add a partial date filter and a range filter to a
FilterSet, filter on a year, month or day, and learn which uncertain dates each includes.Django REST framework: declare a serializer field that reads and writes the ISO form, and learn what a client gets for an entry that is not a partial date.
Moving from django-partial-date: convert a column django-partial-date wrote, point your old migrations at a stand-in field, and correct the values the conversion refuses.