The simplest API
So, I saw a post recently about Build an API under 30 lines of code using Flask.
I started wondering what it would take to do the same in Django.
The two main tools we're going go use are JsonResponse
and ModelForm
.
So, I saw a post recently about Build an API under 30 lines of code using Flask.
I started wondering what it would take to do the same in Django.
The two main tools we're going go use are JsonResponse
and ModelForm
.
Django provides many decorators for use throughout your project. They can be great time savers, and mastering them can help you DRY your code considerable. However, they often confuse people as to how they work, or how to write their own.
In this post I plan to walk through an example of building up a simple decorator that tests if the user has a specific permission, and if not returning a 403 Forbidden response.