What is a Mixin?

Published / by chris / Leave a Comment

You hear a lot about “mixins”, but what exactly is a mixin? And, how can you create your own? A Mixin is a special kind of inheritance in Python (and other object-oriented languages) and it’s starting to get a big rise in Django / Web Application Development. You can use a Mixin to allow classes […]

How to Implement OAuth2 using Django REST Framework

Published / by chris / Leave a Comment

Let’s paint a picture for you. You want to create a web and mobile application that allows your users to login more securely than Token Authentication. You know it’s possible, but you’re not sure how to implement something like this. We can also use Facebook, Google, Twitter, Github, etc. to authenticate users. However, I’m just […]

How to Implement Custom Authentication with Django REST Framework

Published / by chris / Leave a Comment

Introduction to Custom Authentication Custom Authentication in Django REST Framework is the way you would create any time of authentication you would want. In fact, inside of the internals of DRF, you will find every other authentication scheme that I’ve talked about using CustomAuthentication. So, let’s look at an example of how you would implement […]

How to Implement Token Authentication with Django REST Framework

Published / by chris / 14 Comments on How to Implement Token Authentication with Django REST Framework

Token Authentication seems to be an Authentication Scheme that gives people the most trouble. The reason appears to be a misunderstanding not of so much how to implement it, but how to actually use it. For example, the Django REST Framework documentation says that for every request, you have to add an Authorization Header to […]

How do I Implement Session Authentication in Django REST Framework?

Published / by chris / 1 Comment on How do I Implement Session Authentication in Django REST Framework?

Introduction to Session Authentication Session Authentication when used with Django REST Framework allows you to authenticate users very similar to the way Django authenticates users without Django REST Framework. This will make it extremely easy to introduce a REST API to your web app without having to completely overhaul your authentication system. The best part […]

SQLite Doesn’t Care About Your max_length

Published / by chris / Leave a Comment

SQLite databases don’t care about your using of max_length on your models. Let’s look at an example. models.py class Book(models.Model): title = models.CharField(max_length=30) Now, we’ll run some queries. $ ./manage.py makemigrations $ ./manage.py migrate $ ./manage.py shell >>> from book.models import Book >>> title = ‘A’ * 31 >>> print len(title) 31 >>> book = […]

Why Tutorials Suck

Published / by chris / Leave a Comment

When was the last tutorial you’ve taken? It could have been my Free Email Course about Django REST Framework, or it could have been the “Official Django Tutorial” that will have you go through a simple Django Application. What did you think about these tutorials? Which one helped you to learn the best? Why did […]