This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework.authentication import TokenAuthentication | |
from .models import Token | |
class TokenAuthentication(TokenAuthentication): | |
model = Token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import AnonymousUser | |
from rest_framework.authtoken.models import Token | |
from channels.db import database_sync_to_async | |
from channels.middleware import BaseMiddleware | |
from project.settings import SIMPLE_JWT, SECRET_KEY | |
@database_sync_to_async | |
def get_user(token_key): | |
# If you are using normal token based authentication | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from django.contrib import auth | |
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager | |
from django.core import validators | |
from django.core.validators import RegexValidator | |
from django.db import models | |
from django.db.models.signals import post_save | |
from django.dispatch import receiver | |
from django.utils.deconstruct import deconstructible |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Take Image From Galery | |
_takeImageGallery() async{ | |
var picture = await ImagePicker.pickImage(source: ImageSource.gallery); | |
setState(() { | |
imageSource = picture; | |
}); | |
} | |
Future<StreamedResponse> sendPostRequest() async{ | |
try{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def jam(): | |
global array | |
sum = 0 | |
for i in range(len(array)): | |
for j in range(len(array)): | |
sum = sum + array[i][j] | |
return sum |
NewerOlder