mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-03-16 22:40:26 +00:00
Use SplitDateTimeField for date Attribute types (#321)
* fix: use field class SplitDateTimeField for type 'date' Fixes #261 * refactor: remove import conflict of django.forms * style: isort imports * docs: add fix #261 to changelog
This commit is contained in:
parent
d6a05a0ccb
commit
a98c0d2904
2 changed files with 8 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ We follow [Semantic Versions](https://semver.org/) starting at the `0.14.0` rele
|
|||
### Bug Fixes
|
||||
|
||||
- Fixes missing `Add another` button for inlines in `BaseEntityAdmin`
|
||||
- Fixes saving of Attribute date types rendering using `BaseDynamicEntityForm` [#261](https://github.com/jazzband/django-eav2/issues/261)
|
||||
|
||||
## 1.2.3 (2022-08-15)
|
||||
|
||||
|
|
|
|||
13
eav/forms.py
13
eav/forms.py
|
|
@ -2,29 +2,29 @@
|
|||
|
||||
from copy import deepcopy
|
||||
|
||||
from django import forms
|
||||
from django.contrib.admin.widgets import AdminSplitDateTime
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.forms import (
|
||||
BooleanField,
|
||||
CharField,
|
||||
ChoiceField,
|
||||
DateTimeField,
|
||||
Field,
|
||||
FloatField,
|
||||
IntegerField,
|
||||
ModelForm,
|
||||
SplitDateTimeField,
|
||||
)
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from eav.widgets import CSVWidget
|
||||
|
||||
try:
|
||||
from django.forms import JSONField
|
||||
except:
|
||||
JSONField = CharField
|
||||
|
||||
from eav.widgets import CSVWidget
|
||||
|
||||
|
||||
class CSVFormField(forms.Field):
|
||||
class CSVFormField(Field):
|
||||
message = _('Enter comma-separated-values. eg: one;two;three.')
|
||||
code = 'invalid'
|
||||
widget = CSVWidget
|
||||
|
|
@ -66,6 +66,7 @@ class BaseDynamicEntityForm(ModelForm):
|
|||
text CharField
|
||||
float IntegerField
|
||||
int DateTimeField
|
||||
date SplitDateTimeField
|
||||
bool BooleanField
|
||||
enum ChoiceField
|
||||
json JSONField
|
||||
|
|
@ -77,7 +78,7 @@ class BaseDynamicEntityForm(ModelForm):
|
|||
'text': CharField,
|
||||
'float': FloatField,
|
||||
'int': IntegerField,
|
||||
'date': DateTimeField,
|
||||
'date': SplitDateTimeField,
|
||||
'bool': BooleanField,
|
||||
'enum': ChoiceField,
|
||||
'json': JSONField,
|
||||
|
|
|
|||
Loading…
Reference in a new issue