Skip to content

Instantly share code, notes, and snippets.

View ArturTan's full-sized avatar

Artur Tanona ArturTan

  • Programming since August 2016 - continously improving my skills
  • Wrocław
View GitHub Profile
@jsmedmar
jsmedmar / token.py
Last active October 23, 2021 10:30
A django LoginRequiredMixin that allows token authentication.
from django.contrib.auth import mixins
from rest_framework.authentication import SessionAuthentication
from rest_framework.authentication import TokenAuthentication
from rest_framework import generics
class TokenLoginRequiredMixin(mixins.LoginRequiredMixin):
"""A login required mixin that allows token authentication."""
def dispatch(self, request, *args, **kwargs):