slashmili / django-jalali

Jalali DateField support for Django model
http://pypi.python.org/pypi/django_jalali
BSD 3-Clause "New" or "Revised" License
240 stars 50 forks source link

Time formatting in Django rest framework #236

Closed hosseincodes closed 3 months ago

hosseincodes commented 3 months ago

hi, I use the Django rest framework and there is a problem with time formatting how can I change the format of time like this 15 مهر ۱۴۰۲ ساعت ۱۵:۲۰ instead of this 1402-12-29T14:41:02.919282+0330 the document said to use {{ my_date|jformat:"%A %d %B %Y %H:%M" }} {# specific formatting #}‍‍

but it is for templates only, I am using the Django rest framework! here is my model and resializer:

class Post(models.Model):
    created_at = jmodel.jDateTimeField(auto_now_add=True)
class PostSerializer(serializers.ModelSerializer):

    class Meta:
        model = Post
        fields = '__all__'

is there any extra setting?