Closed mshzsh closed 2 years ago
Could you please provide more information? Django and django-jalali version? Please provide an example code or test to make it easy to understand
Django : 4.0.6 django-jalali : 6.0.0 djangorestframework : 3.13.1
class User(models.Model):
birthdate = jmodels.jDateField(null=True)
class UserDetailsSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['birthday']
curl --location --request PATCH 'http://127.0.0.1:4801/user-details/' --form 'birthdate="1371-12-07"'
Response : {"birthdate": "750-09-16"}
Based on the doc, You need to define your field in serializer as well. So:
from django_jalali.serializers.serializerfield import JDateField
class UserDetailsSerializer(serializers.ModelSerializer):
birthdate = JDateField()
class Meta:
model = User
fields = ['birthday']
@mshzsh if it's fixed your problem. Please close the issue
I send
1371-12-07
to jDateField but it save750-09-16