While trying to check test coverage for a file that had multiple Class Based Views (CBV) everything was returning as coverage but they weren’t! I couldn’t understand why and it took me days until I get to an answer! So I wrote this post to make it more easily accessible 😊
In today’s development, tests are a fundamental tool for keeping things nice and easy and to keep programmer’s sanity. I’ve been using a set of tools for developing my web applications with Django and it is time for me to share a little bit about them.
As I talked to some people, few new about Django’s Generic Relation and Generic Foreign Key. And when I was studying it to apply on our system, I realised that the documentation can be kind of tricky and sparse. Nevertheless, Generic Relations helped us a lot, and so I decided to write about it in this blog post :)
I had a Django model that had 2 regular attributes and a user Foreign Key:
This post could also be called what comes after the tutorials :)
In several Django tutorials, we learn how to receive requests and return responses with html pages having several information. This is very easy to start understanding the process that Django does: receiving requests and returning templates. But what happens after that?
Most of all Django tutorials teach us how to return HTML as response to a request. Sometimes, it is useful to make it a little more RESTful. One option is to use Django REST Framework but sometimes you need something a little bit simpler. Then you have Restless. Restless is a miniframework made by Daniel Lindsley based on what he learned by making Tastypie and some other REST libraries.