- Fixed: Proper manipulation with
BaseStrategy
instances during population
- Added:
AliasStrategy
for overriding property name on target object duringsetattr()
- Changed:
field_strategy
now can be also an instance ofBaseStrategy
- Fixed: Fixed calling population methods when declared in form
- Added: Introduced extra optional arguments when creating
From
instance
- Added:
GeoJSON
field introduced - Changed: Default clean method
Form.clean
is only called when there are no errors.
CI/CD fixies and project settings. There was no application change.
Release by @paimvictor
- Added: Introduced
RRuleField
to represent Recurrence Rule objects
- Added: Introduced defining a form field for the dictionary key in
DictionaryField
- Changed:
value_field
inDictionaryField
is forced keyword arguments - Changed: Replaced
RuntimeError
withApiFormException
- Fixed: Fixed missing validation errors
- Changed:
Form.add_error()
now takes onlyTuple
as afield
argument
- Fixed: Removed validation of non-required fields if they are not present in the request
- Fixed: Fixed "weird" behaviour with missing
clean_data
values if usingListField
This release has been inspired by Problem Details for HTTP APIs - RFC7807 and blog post Structuring validation errors in REST APIs written by @k3nn7.
The main idea has been to simplify validation process on the client side by flattening errors output. To achieve such a goal, the whole validation process has been rewritten (and luckily for us, much simplified).
- Changed: Positional validation errors for lists
- Changed:
ImageField
andFileField
requires Data URI (issue Raise ValidationError in invalid Data URI by default) - Removed:
Form.fill()
method replaced byForm.populate()
- Removed:
fill_
methods replaced by population strategies
- Changed: Raw base64 payload in
FileField
andImageField
firesDeprecationWarning
. Use Data URI instead.
- Added: Introduced
mapping
- Added: Override strategies using
field_type_strategy
andfield_strategy
- Fixed:
DictionaryField
was unable to raise validation errors for keys
Anniversary release 🥳
- Added: Population strategies introduced
- Added:
fill
method is deprecated and replaced bypopulate
- Added:
Settings
object introduced (form.settings
) - Added: Pluggable content-type parsers using
DJANGO_API_FORMS_PARSERS
setting
- Changed:
mime
argument inFileField
is supposed to be atuple
- Added:
FieldList
andFormFieldList
now supports optional min/max constrains usingmin_length
/max_length
- Added:
ModelForm
class introduced (experimental, initial support - not recommended for production)
- Added:
fill_method
introduced
- Fixed: Pillow image object have to be reopened after
Image.verify()
call inImageField::to_python
- Fixed:
ApiFormException('No clean data provided! Try to call is_valid() first.')
was incorrectly raised if request payload was empty duringForm::fill
method call - Changed:
clean_data
property is by defaultNone
instead of empty dictionary
- Fixed: Fixed issue with
clean_
methods returning values resolved as False (False
,None
,''
)
- Fixed: Ignore
ModelMultipleChoiceField
inForm::fill()
One more step to get rid of pytest
in project (we don't need it)
- Changed: Correctly resolve key postfix if
ModelChoiceField
is used inForm::fill()
- Changed:
DjangoApiFormsConfig
is created
- Added:
FileField.content_type
introduced (contains mime)
- Added:
FileField
andImageField
introduced - Added: Defined extras in
setup.py
for optionalPillow
andmsgpack
dependencies - Added: Working
Form::fill()
method for primitive data types. IntroducedIgnoreFillMixin
- Added:
BaseForm._request
property introduced (now it's possible to use request inclean_
methods)
- Fixed: Fixed
Content-Type
handling ifcharset
orboundary
is present
- Fixed: Do not call resolvers methods, if property is not required and not present in request
- Changed: Non specified non-required fields will no longer be available in the cleaned_data form attribute.
- Changed: All package exceptions inherits from
ApiFormException
. - Fixed: Specifying encoding while opening files in
setup.py
(failing on Windows OS).
- Changed: Moved field error messages to default_error_messages for easier overriding and testing.
- Fixed: Fix KeyError when invalid values are sent to FieldList.
- Fixed: Removed unnecessary error checking in FieldList.
- Added: Tests for fields
- Changed: Remove DeclarativeFieldsMetaclass and import from Django instead.
- Changed: Msgpack dependency is no longer required.
- Changed: Empty values passed into a FormField now return {} rather than None.
- Fixed: Throw a more user friendly error when passing non-Enums or invalid values to EnumField.
- Changed Use poetry instead of pipenv
- Changed: Library renamed from
django_api_forms
todjango-api-forms
(cosmetic change without effect)
- Changed: Library renamed from
django_request_formatter
todjango_api_forms
- Changed: Imports in main module
django_api_forms
- Added:
BooleanField
introduced
- Fixed: Pass
Invalid value
asValidationError
not as astring
- Fixed: Introduced generic
Invalid value
error message, if there isAttributeError
,TypeError
,ValueError
- Fixed: Fixing issue from version
0.5.5
but this time for real - Changed: Renamed version file from
__version__.py
toversion.py
- Fixed: Check instance only if there is a value in
FieldList
andFormFieldList
- Fixed: Added missing
msgpack`` dependency to
setup.py`
- Added: Introduced generic
AnyField
- Fixed: Skip processing of the
FormField
if value is not required and empty
- Fixed: Process
EnumField
even if it's not marked as required
- Changed: Use native
django.form.fields
if possible - Changed: Removed
kwargs
propagation from release0.3.0
- Changed: Changed syntax back to
django.forms
compatible (e.g.form.validate_{key}()
->form.clean_{key}()
) - Changed:
FieldList
raisesValidationError
instead ofRuntimeException
if there is a type in validation - Changed: Use private properties for internal data in field objects
- Fixed:
FieldList
returns values instead ofNone
- Fixed: Fixed validation in
DictionaryField
- Added: Basic unit tests
- Fixed: Fixed
Form
has no attributeself._data
- Fixed: If payload is empty, create empty dictionary to avoid
NoneType
error
- Added: Introduced
UUIDField
- Added: Introduced
DictionaryField
- Added: Propagate
kwargs
fromForm.is_valid()
toForm.validate()
andForm.validate_{key}()
methods
- Fixed: Fixed
to_python()
in FormFieldList
- Changed:
Form.validate()
replaced byForm.is_valid()
- Added:
Form.validate()
is now used as a last step of form validation and it's aimed to be overwritten if needed - Added: Unit tests initialization
- Fixed: Non-required EnumField is now working
- Added: WIP: Initial method for filling objects
Form::fill()
- Fixed: Assign errors to form before raising
ValidationError
- Fixed: Do not return empty error records in
Form:errors
- Fixed: Use custom
DeclarativeFieldsMetaclass
because of customField
class - Fixed: Do not return untouched fields in
Form::payload
- Fixed: Fix for None
default_validators
inField
- Added: Support for
validation_{field}
methods inForm
(initial support)
- Added:
EnumField
- Added: First version of
Form
class - Added:
CharField
- Added:
IntegerField
- Added:
FloatField
- Added:
DecimalField
- Added:
DateField
- Added:
TimeField
- Added:
DateTimeField
- Added:
DurationField
- Added:
RegexField
- Added:
EmailField
- Added:
BooleanField
- Added:
RegexField
- Added:
FieldList
- Added:
FormField
- Added:
FormFieldList