Django weekday catch!

Just a catch in django weekday, its incompalitable with standrad python weekday numbering. You can get weekday in django using Sale.objects.get(sale_date__week_day=2) or ExtractWeekday.

Read More

Dango Rest Framework Tips

The request object will be passed only if DRF constructs the serializer for you, for example when you just pass the serializer_class to a ModelViewSet. But if you are using the Serializer in your custom views, please do remember to pass the request manually, otherwise it won’t work. item_serializer = ItemSerializer(item, context={“request”: request})

Read More

Drf File Upload

I wanted to upload some json data and a file to on an django api (using drf). But sirprisingly all the solutions pointed to first uploading the file and then send the json in two seprate requests. So this is my note on how i worked it out.

Read More