DEV Community

Papan Sarkar
Papan Sarkar

Posted on

Don't write queries inside serializers in Django!

Don't Do it

Why?

  • It should focus data conversion and validations only. Don't write database logic on this.

  • Not efficient and bad performance. It will create lots of queries

  • You can not reuse it

  • Very hard to test

  • Readability is gone

I can share the alternatives if you want! Let me know

Top comments (0)