General Talks: DRY your Django APIs
Submitted by Sourav Basu (@souravbasu17) on Friday, 25 August 2017
Technical level: Intermediate Status: Rejected
Your Django APIs start small and grow into a mess unless checked in time. This talk is how we can keep those APIs clean and small even with huge number of methods and classes using some sort of architecture. This is aimed at both the beginner and intermediate level of Django developers.
I will be covering both REST Framework Views and basic Django Views using templates.
We keep having existential checks for every API that requires some data. Also sometimes we have to check for data type. We can cut down on these lines of code.
This is about giving proper error messaging. Its more than having a strings file where we pass the same string. How about having to write the exception handling only once and forget about it.
This is more of a personal experience of structuring that helped me. This is not necesarrily the only way.
Cleaner DB operations
Db APIs should raise Errors and they should be handled in a clean way so as to maintain uniformity across APIs.
I work for an organization called Credy where we have implemented the things mentioned in this talk and I am part of a team that implemented this and part of the whole idea of implementation as well. I have been working professionally on Django/Python since 2015 and I am aware of some of the problems that this talk solves.