Multiple serializers vs multiple views in Django Rest Framework

Photo by engin akyurt on Unsplash

When you create simple CRUD API views in Django Rest Framework I guess that most of the time you create only two endpoints: one for list/create actions and the second one for retrieve/update/destroy actions.

Implementing only one view for multiple actions means having also only one serializer for them. Less code, more ‘DRY’, isn’t it? However, sometimes it’s not so good, because our API may require different formats of data in every action. So what to do if that happens to us?

There are many solutions and different approaches to that problem and I’ll try to present a few of…


Turn your users into customers

Photo by rupixen.com on Unsplash

Introduction

Have you ever wanted to create an app in which the users would have to pay a few one-time fees and have a periodic subscription as well? On the one hand, you’d like to keep as much information as needed to have control over your customers and their payments. On the other hand, credit cards data are really sensitive, and storing them in your database would be very risky.

Fortunately, there’s a very interesting solution. Integrating your app with Stripe will save you time and provide a really clean and safe payment process. …

Ewelina Bosko

Passionate about programming and writing :). I work as a software developer, mostly in Django and ReactJS. You can reach me here: https://pogromcykodu.pl

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store