Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Error for my model with ManyToManyField in Django
I am working for a personal project that is using an API and having user authentication with JWT (but used in serializer). I wanted to implement ManyToManyField for user and city but it doesn't work properly. This is the extended model I have found . I want that the UserSearchLocation to store the City and when logged in to see the city, while other users will not see it until the search same city. models.py from django.db import models from django.contrib.auth.models import User class UserSearchLocation(models.Model): id = models.AutoField(primary_key=True, editable=False) search = models.CharField(max_length=50, null=True) user = models.ManyToManyField(User, related_name="my_cities", blank=True) def __str__(self): return self.search class City(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) city = models.ForeignKey(UserSearchLocation, on_delete=models.SET_NULL, null=True) id = models.AutoField(primary_key=True, editable=False) location = models.CharField(max_length=85) def __str__(self): return f'{self.location}, {self.country_code}' def save(self, *args, **kwargs): self.location = self.location.capitalize() self.country = self.country.capitalize() self.country_code = self.country_code.capitalize() return super(City, self).save(*args, **kwargs) serializers.py class ForecastSerializer(serializers.ModelSerializer): id = serializers.IntegerField() city = serializers.StringRelatedField() country_code = serializers.StringRelatedField() country = serializers.StringRelatedField() class CitySerializer(serializers.ModelSerializer): class Meta: model = City fields = "__all__" class UserSearchLocationSerializer(serializers.ModelSerializer): class Meta: model = UserSearchLocation fields = "__all__" To add in localhost/admin/ a CitySearchLocation works, but when to add a City I have this error: column base_city.location does not exist … -
django.urls.exceptions.NoReverseMatch: Reverse for xxx not found. xxx is not a valid view function or pattern name
I have problem bcz i get: Powershell: django.urls.exceptions.NoReverseMatch: Reverse for 'register' not found. 'register' is not a valid view function or pattern name. Project Schematic: https://ibb.co/g39qB9k Error during template rendering: https://ibb.co/q0QkwvQ html: <section> <!-- Navbar --> <nav class="navbar navbar-expand-lg bg-dark navbar-dark "> <!-- Container wrapper --> <div class="container-fluid justify-content-center"> <!-- Navbar brand --> <a class="navbar-brand" href="{% url 'home_page' %}"> Turbine Power Web</a> <div class="collapse navbar-collapse" id="navbarResponsive"> <ul class="navbar-nav ms-auto"> {% if user.is_authenticated %} <li class="nav-item"><a class="nav-link" href="{% url 'accounts:logout' %}">Logout</a></li> <li class="nav-item"><a class="nav-link" href="{% url 'accounts:password_change' %}">Change Password</a></li> {% else %} <li class="nav-item"><a class="nav-link" href="{% url 'accounts:login' %}">Login</a></li> <li class="nav-item"><a class="nav-link" href="{% url 'accounts:user-registration' %}">Register</a></li> {% endif %} <li class="nav-item"><a class="nav-link" href="">Turbine Models</a></li> <li class="nav-item"><a class="nav-link" href="">Author</a></li> {% if user.is_company %} <li class="nav-item"><a class="nav-link" href="">My Models</a></li> {% endif %} <li class="nav-item"> Hello, {{ user.username|default:'Guest' }} </li> </ul> </div> </div> </nav> <!-- Navbar --> </section> views: def home_page(request): return render(request, 'turbineweb/home_page.html') project urls: urlpatterns = [ path('admin/', admin.site.urls), path('', include('accounts.urls', namespace='accounts')), path('', include('turbineweb.urls')), accounts urls: app_name = 'accounts' urlpatterns = [ path('login/', CustomLoginView.as_view(redirect_authenticated_user=True, template_name='accounts/login.html', authentication_form=LoginForm), name='login'), path('logout/', auth_views.LogoutView.as_view(template_name='accounts/logout.html'), name='logout'), path('registration/', RegisterView.as_view(), name='users-registration'), path('password-change/', ChangePasswordView.as_view(), name='password_change'), path('password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'), path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), ] turbineweb urls: app_name … -
How to fix ERR_TOO_MANY_REDIRECTS?
I'm developing a site on Django, but I got an error ERR_TOO_MANY_REDIRECTS. I think that the matter is in the views.py file. Help figure it out. P.S. already tried to delete cookie files, it didn't help( from email import message from wsgiref.util import request_uri from django.shortcuts import redirect, render from django.contrib.auth.models import User, auth from django.contrib import messages # Create your views here. def reg(request): if request.method == 'POST': username = request.POST['username'] password = request.POST['password'] cpassword = request.POST['cpassword'] if password == cpassword: if User.objects.filter(username=username): messages.info(request, 'Username taken') return redirect('registration') else: user = User.objects.create_user(username=username, password=password) user.save() return redirect('login') else: messages.info(request, 'Passwords not matching') return redirect('registration') return redirect('/') else: return render(request, 'registration.html') def login(request): if request.method == "POST": username = request.POST['username'] password = request.POST['password'] user = auth.authenticate(username = username, password = password) if user is not None: auth.login(request, user) return redirect('/') else: messages.info(request, 'Invalid credentials') return redirect('login') else: return render(request, 'login.html') def logout(request): auth.logout(request) return redirect('/') -
xhtml2pdf use a personal Font but not view my font
I need to create a pdf and I need my own font which is present in static / font / I just don't understand how to import it. the font always remains the same and I don't know how to do it, can someone help me? <style> @font-face { font-family: 'Titolo'; src: url('/static/font/titolo.ttf') format('truetype'); } @page { size: A4 portrait; @frame header_frame { -pdf-frame-content: header; top: 10mm; width: 210mm; margin: 0 10mm; } } h1{ font-family: 'Titolo'; color: red; font-size: 4rem; margin-bottom: 0; line-height: 1; } </style> -
Django: int() argument must be a string, a bytes-like object or a number, not 'datetime.timedelta'
I would like to aggregate with a queryset and compare the difference in minutes between 2 datetime in Django. And I would like to have the result in minutes (rounded). opened_at and created_at are DateTimeField fields. @action(detail=False, methods=["get"], url_path="person-click-speed") def person_click_speed(self, request): accounts = get_account_ids(request) queryset = models.CoursePerson.objects.filter( account__in=accounts, ) data = queryset.aggregate( less_5_mint_count=Count( "uid", average_clic_time=Avg(F('emails_person__opened_at') - F('emails_person__created_at')), ) res = { 'less_5_mint_count': data['less_5_mint_count'], 'average_clic_time': round(data['average_clic_time'].total_seconds() / 60 if data['average_clic_time'] else 0), } return Response(data=res) This code works well but I need to do that directly in the aggregate (average_clic_time). -
Is there anyway to set auth token for my Django Project (Not django-rest)
hi im looking how to expire the token of user in 1hour...i guess Django uses the default time of 24Hours . -
How to make sure celery will receive our tasks?
I'm having a problem when using celery I'm handling my upload-file api with celery and sometimes it does not receive the task and my file will not upload into MINIO, And sometimes it does receive the tasks and the upload is successful. What can be the problem? And How can we make sure that celery will receive the task? I'm using Django as a backend framework. -
Form data not stored in database. What is the problem?
This form working working perfectly, class FeedBackForm(forms.Form): feedBACK = forms.CharField(widget=forms.Textarea, required=True) But this form didn't work class FeedBackForm(forms.Form): feedBACK = forms.CharField(widget=forms.Textarea, required=True) rating = forms.CharField(widget=forms.IntegerField, required=True) It is showing below error. Where did the problem occur? I checked documentation but no clue I found. AttributeError at /quick_view/11/ 'IntegerField' object has no attribute 'value_from_datadict' Request Method: POST Request URL: http://127.0.0.1:8000/quick_view/11/ Django Version: 4.0.4 Exception Type: AttributeError Exception Value: 'IntegerField' object has no attribute 'value_from_datadict' Exception Location: D:\1_WebDevelopment\17_Ecomerce Website\ecomerce site\env\lib\site-packages\django\forms\forms.py, line 224, in _widget_data_value Python Executable: D:\1_WebDevelopment\17_Ecomerce Website\ecomerce site\env\Scripts\python.exe Python Version: 3.9.5 Python Path: ['D:\\1_WebDevelopment\\17_Ecomerce Website\\ecomerce site', 'c:\\users\\dcl\\appdata\\local\\programs\\python\\python39\\python39.zip', 'c:\\users\\dcl\\appdata\\local\\programs\\python\\python39\\DLLs', 'c:\\users\\dcl\\appdata\\local\\programs\\python\\python39\\lib', 'c:\\users\\dcl\\appdata\\local\\programs\\python\\python39', 'D:\\1_WebDevelopment\\17_Ecomerce Website\\ecomerce site\\env', 'D:\\1_WebDevelopment\\17_Ecomerce Website\\ecomerce ' 'site\\env\\lib\\site-packages'] Server time: Wed, 13 Jul 2022 10:41:38 +0000 -
post method is not working in single page django website
I'm learning Django from youtube. now I'm practicing on a project but the problem is the youtube tutorial used multi page django website while i'm developing a single page website where if you click a menu item, it will scroll down to the section instead of opening a new page. I had created only one app. I am really confused because as I have only 2 html page( one main and another with different layout for blog), I really don't know how to mention the pages in views.py. I have connected post method to home function but the post isn't working. views.py: from django.shortcuts import render, HttpResponse from django.http import HttpResponse # Create your views here. def home(request): if request.method == "POST": print("This is post") return render(request, 'index.html') def blog(request): if request.method=="POST": print("This is post") return render(request, 'blog-single.html') urls.py from app: from django.contrib import admin from django.urls import path, include from portfolio import views urlpatterns = [ path('admin/', admin.site.urls), path('home', views.home, name='home'), ]``` -
Django ORM query with user defined fields
I'm trying to create an Django ORM query to replace a really messy raw SQL query i've written in the past but i'm not sure if Django ORM can let me do it. I have three tables: contacts custom_fields custom_field_data What I'm hoping to be able to do with the ORM is create an output as if i've queryied one single table like this: Is such a thing possible with the ORM? -
restoring dump backup not working with dj rest auth EmailAddress model
I use dj rest auth to register and login users and i have successfully made and restored a dump backup from my database with django-dbbackup my problem is when i restore backup , the data saved in EmailAddress model from dj rest auth is not restoring which means the login for users is not working and i get the error EmailAddress matching query does not exist and when i login the admin panel and add the emailaddress manually in EmailAddress it works again!how can i create a backup with EmailAddress model as well ? -
django.db.utils.OperationalError: (1050, "Table 'accounts_profile_branch' already exists")
Found another file with the destination path 'admin/js/cancel.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path. -
Getting 499 error while GET request and "Ignoring connection EPIPE" at Gunicorn. Django +NGINX + Gunicorn + INGRESS
I am trying to migrate my application to kubernetes from the docker host. The app is built using Django, Nginx, Gunicorn. The app is loading perfectly in k8s. Container is able to connect to database (verified via telnet). App is able to run multiple GET requests successfully, But one GET request is giving below error: "GET /MyApp/URL/?=10 HTTP/1.1" 499 0 "https:///MyApp/URL/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36" And in Gunicorn error logs I get below error: [2022-07-13 08:08:41 +0000] [107] [DEBUG] GET /MyApp/URL/ [2022-07-13 08:21:51 +0000] [105] [DEBUG] Ignoring connection epipe [2022-07-13 08:37:36 +0000] [107] [DEBUG] Ignoring connection epipe How to resolve this? Adding all the configuration I have done at Ingress, Nginx, Gunicorn level: Ingress.yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: app-name namespace: {{ .Release.Namespace }} annotations: nginx.ingress.kubernetes.io/proxy-connect-timeout: "1000" nginx.ingress.kubernetes.io/proxy-read-timeout: "1000" nginx.ingress.kubernetes.io/proxy-send-timeout: "1000" nginx.ingress.kubernetes.io/allow-backend-server-header: "true" spec: rules: - host: {{ .Values.ingress_hostname }} http: paths: - backend: service: name: app-service port: number: 443 path: / pathType: ImplementationSpecific tls: - hosts: - {{ .Values.ingress_hostname }} secretName: {{ .Values.tls.name }} service.yaml apiVersion: v1 kind: Service metadata: name: app-service namespace: {{ .Release.Namespace }} labels: {{- include "app-name.labels" . | nindent 4 }} spec: type: ClusterIP ports: - … -
Django aggregate with expressions between ForeignKey (and not) values
I'm having these models class Car(models.Model): liter_per_km = models.FloatField(default=1.0) class DrivingSession(models.Model): car = models.ForeignKey(Car, on_delete=models.CASCADE) km = models.FloatField(default=1.0) Is there a way using Django features (e.g aggregate) to calculate the same total_liters like in code below? total_liters = 0.0 for session in DrivingSession.objects.all(): total_liters += (session.km * session.car.liter_per_km) -
The b-button is not displayed in the b-table VueJs
Im starting at Vue Js, my problem is that my b-button is not shown in my table and I don't understand why. Here is my HTML code: <div id="listlocales"> <div class="overflow-auto"> <b-button size ="sm" href="{% url 'newLocal'}" variant="outline-primary"> Nuevo Local</b-button> <br></br> <b-table id="my-table" striped responsive="sm" :items="items" :fields="fields" :per-page="recordsPerPage" :current-page="currentPage"> <template #cell(actions)='data'> <b-button size="sm" variant="primary" @click="getLocales()"> Editar </b-button> <b-button size="sm" variant="danger" href="{% url 'newLocal' %}"> Eliminar </b-button> </template> </b-table> <b-pagination v-model="currentPage" :total-rows="totalPages" :per-page="recordsPerPage" aria-controls="my-table" ></b-pagination> </div> </div> <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.js"></script> <script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.js"></script> <script src="https://unpkg.com/axios/dist/axios.min.js"></script> And here is my script Vue code: <script> const listloc = new Vue({ el: '#listlocales', data: { items: [], currentPage: 1, totalPages: 0, recordsPerPage: 10, isLoading: false, fields: [ { key: 'id', label: 'ID' }, { key: 'descripcion', label: 'Descripcion' }, { key: 'clave', label: 'Clave' }, { key: 'responsable', label: 'Responsable' }, { key: 'actions', label: ''} ] }, ... }); </script> </body> </html> I tried to use v-slot instead cell but isn't working anyway... Can someone help me for solving this issue. -
Image not visible despite correct syntax
I am doing CRUD using serializers,and one of the data is uploading the image,the problem is that despite the correct syntax,the image is not getting uploaded below is the product_list image html code {% if result.image %} <td> <img src="{{result.image.url}}" alt="no image"> </td> {% endif %} below are the functions and additions made in settings settings STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ] MEDIA_ROOT = os.path.join(BASE_DIR,'media') MEDIA_URL = '/media/' functions and model class Products(models.Model): categories = models.ForeignKey(Categories,on_delete=models.CASCADE) sub_categories = models.ForeignKey(SUBCategories,on_delete=models.CASCADE) color = models.ForeignKey(Colors,on_delete=models.CASCADE) size = models.ForeignKey(Size,on_delete=models.CASCADE) image = models.ImageField(upload_to = 'media/',width_field=None,height_field=None,null=True) title = models.CharField(max_length=50) price = models.CharField(max_length=10) sku_number = models.CharField(max_length=10) product_details = models.CharField(max_length=300) quantity = models.IntegerField(default=0) isactive = models.BooleanField(default=True) def filepath(request,filename): old_filename = filename timeNow = datetime.datetime.now().start('%Y%m%d%H:%M:%S') filename = "%s%s" % (timeNow,old_filename) return os.path.join('uploads/',filename) where am I going wrong in the code? -
How to add Authenticate Middleware JWT django REST?
I'm a begginer in using Django and REST. And in my project I have to add custom JWT auth. I've tried to generate it like this inside of User model: class User(AbstractUser): .... def _generate_jwt_token(self): dt = datetime.datetime.now() + datetime.timedelta(days=60) token = jwt.encode({ 'id': self.pk, 'exp': int(dt.strftime('%s')) }, settings.SECRET_KEY, algorithm='HS256') return token.encode("windows-1252").decode("utf-8") In my views I did class LoginAPIView(APIView): def post(self, request): ... response = Response() response.set_cookie(key="jwt", value=user.token, httponly=True) ... return response And class CurrentUserAPIView(APIView): def get(self, request): token = request.COOKIES.get('jwt') if not token: raise AuthenticationFailed('This user is unauthenticated') try: payload = jwt.decode(token, settings.SECRET_KEY, algorithms=['HS256']) except: msg = 'Invalid authentication. Could not decode token.' raise AuthenticationFailed(msg) try: user = User.objects.get(pk=payload['id']) except User.DoesNotExist: msg = 'No user matching this token was found.' raise AuthenticationFailed(msg) serializer = UserSerializer(user) return Response(serializer.data, status=status.HTTP_200_OK) But I think this logic has to be inside a middleware. Could you give me an advice how can I rewrite this code. Thank you so much! -
Django URLfield st
Trying to build Django Models with Django rest_framework serializers. Models should store list of URLs searched by a user and the serializer should help return combination of those urls. Got it to work based on documentation and two answered questions (first, second), but cannot figured how to get a desired formatting: unpack a list of dictionaries inside returned rest_framework response. Current api output looks like that: What I would want is for links to be just a list of urls instead of dictionaries. models.py (short version): class User(AbstractUser): pass class Combo(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='searches') updated = models.DateTimeField(auto_now = True) created = models.DateTimeField(auto_now_add = True) class ComboLink(models.Model): combo = models.ForeignKey('Combo', on_delete=models.CASCADE, related_name='links') link = models.URLField(null=True, blank=True) serializers.py: class ComboLinkSerializer(ModelSerializer): class Meta: model = ComboLink fields = ['link'] class ComboSerializer(ModelSerializer): links = ComboLinkSerializer(many=True) class Meta: model = Combo fields = ['user', 'id', 'created', 'links'] -
my custom django_admin command got error AttributeError: object has no attribute 'title'
So I am working on RSS Feed on Django. Whenever I try to run the custom command file (startjobs.py) in command prompt, the error appeared: Job "fetch_talkpython_posts" raised an exception Traceback (most recent call last): File "C:\xxx\xxx\anaconda3\lib\site-packages\feedparser\util.py", line 156, in __getattr__ return self.__getitem__(key) File "C:\xxx\xxx\anaconda3\lib\site-packages\feedparser\util.py", line 113, in __getitem__ return dict.__getitem__(self, key) KeyError: 'title' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\xxx\xxx\anaconda3\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) File "C:\xxx\xxx\django_project\pyagg\content_aggregator\news\management\commands\startjobs.py", line 39, in fetch_talkpython_posts save_new_posts(_feed) File "C:\xxx\xxx\django_project\pyagg\content_aggregator\news\management\commands\startjobs.py", line 18, in save_new_posts feed_title = feed.channel.title File "C:\xxx\xxx\anaconda3\lib\site-packages\feedparser\util.py", line 158, in __getattr__ raise AttributeError("object has no attribute '%s'" % key) AttributeError: object has no attribute 'title' I couldn't figure out why this error occured and what's wrong with fetch_talkpython_posts(). Any help would be appreciated. my custom command file startjobs.py: import logging from django.conf import settings from django.core.management.base import BaseCommand import feedparser from dateutil import parser from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.triggers.cron import CronTrigger from django_apscheduler.jobstores import DjangoJobStore from django_apscheduler.models import DjangoJobExecution from news.models import Post logger = logging.getLogger(__name__) def save_new_posts(feed): feed_title = feed.channel.title feed_image = feed.channel.image["href"] for item in feed.entries: if not Post.objects.filter(link=item.link).exists(): post = Post( title=item.title, description=item.description, pubdate=parser.parse(item.published), link=item.link, image=feed_image, #p_title=feed_title, … -
Input value Set using jquery's selector does not post
there's this issue where I created a form using django. The form contains two charfields for name and address, and two datetimefields one for a start_date and the other for a stop_date. Finally there are two radio buttons, such that: when the first is checked, the start_date field's value is set to date.now() using jquery's selector when the second radio button is checked, the start_date and stop_date fields are disabled, still using jquery's selector. The above code works well. However, when the start_date's value is successfully set, I have to post the form data using jquery ajax post method to a django view, the start_date's value is not posted at all, while the other field values are. I don't know how to go about this issue. Here's my code template.html {% extends 'base.html' %} <div class="center"> <form action="" invalidate> {% crispy form form.helper %} </form> </div> script.js $('input:radio').click(function){ if ($(this).val() === '1'){ var start_date = new Date(); $('#id_start_date').val(start_date); } else if ($(this).val() === '0'){ document.getElementById('id_stop_date').disabled = true; document.getElementById('id_start_date').disabled = true; } } $("form").on("submit", function (e){ var name = $("#id_name"); var type = $("id_type"); var start_date = $("id_start_date"); var stop_date = $("id_stop_date"); $.ajax({ type:"POST", url:"{% url 'postAccount' %}", data:{ csrfmiddlewaretoken: document.querySelector('input[name="csrfmiddlewaretoken"]').Val(), … -
How to print variable of nested for loop in django?
I want print values from database to html page Here is my code:enter image description here instead of writing {{i.id}} or {{i.date}} I want id and date to come from a list called colname so the first loop will contain object (i.e. i) from database and the second loop contains all the columns name (i.e. j) and I want to print {{i.j}} but I am not able to get any value -
How to write a view to add a user to a group in Django rest framework
I want to write a view that can add my users to a group Please help, thank you -
django.db.utils.IntegrityError: NOT NULL constraint failed: new_carts_cartitem.cart_id
how to handle this error? django.db.utils.IntegrityError: NOT NULL constraint failed:new_carts_cartitem.cart_id When I add "orders" app, this error occurs. My Project: [1]: https://github.com/chickenhihi/GreatCart Help me, please ! Thank you very much... -
How can I make two user models, "Customer" and "Dealer" with different table in django
I'm New in Django and I'm working on a project in which I want to make separate Login, Logout, Verification and Reset Password apis with JWT I'm trying to get different tables so that if one tries to login in Dealer Id from Customer id, then it won't accept it and so the person has to register on Dealer api too My models.py is like this from django.db import models from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager, PermissionsMixin) from rest_framework_simplejwt.tokens import RefreshToken class UserManager(BaseUserManager): def create_user(self, username, email, mobile_number, account_role, account_type, role, address, state, city, pincode, password = None): user = self.model(username = username, email = self.normalize_email(email), mobile_number = mobile_number, account_role = account_role, account_type = account_type, role = role, address = address, state = state, city = city, pincode = pincode) user.set_password(password) user.save() return user def create_superuser(self, username, email, mobile_number, account_role, account_type, role, address, state, city, pincode, password = None): if password is None: raise TypeError('Password Should Not Be None') user = self.create_user(username, email, password, mobile_number, account_role, account_type, role, address, state, city, pincode) user.is_superuser = True user.is_staff = True user.save() return user class User(AbstractBaseUser, PermissionsMixin): username = models.CharField(max_length=255, unique=True, db_index=True) email = models.EmailField(max_length=255, unique=True, db_index=True) mobile_number = models.CharField(max_length=12) account_role = models.CharField(max_length=50, default='Customer') … -
How to implement OpenID Connect with multiple providers in Django?
I'm trying to implement multiple SSO (OpenID Connect) logins in my application, besides the regular one. The current provider requests are Azure and Okta, but there will be more. For every bigger customer using my application, I want to be able to enable them a custom SSO login that they can setup in the admin panel. All the libraries I've tried using for this are either using settings.py and local django authentication, or they are deprecated. The flow is like this: User chooses their company and SSO login button -> Gets redirected to login -> I send the client id, secret etc. (which they entered in the admin panel when registering an sso connection) -> I get a token in return with the users name and email -> with this info (email) I find the already existing user in my local database and log him in