Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
how can i use the object_list in django listview in multiple templates?
class PostListView(ListView): model = Post def get_queryset(self): return Post.objects.filter(published_date__lte = timezone.now()).order_by('-published_date') I want to use the object_list in this listview in multiple templates. I have 4 templates each of a certain category in which i want to use this list and filter the list according to the template.So is it possible to use this list in more than 1 template -
django user custom model authentication and authorization
I have created a custom user model and wanted to move it from the app panel to the auth panel in the admin page. To do that I created a proxy user model the following: class User(AbstractUser): pass class ProxyUser(User): pass class Meta: app_label = 'auth' proxy = True and then in admin.py: from django.contrib.auth.admin import UserAdmin from .models import User, ProxyUser admin.site.register(ProxyUser, UserAdmin) The problem is that when I go to group model both user models are shown in the permissions list: Am I missing something? Thanks in advance -
django-select2 store multiple selection
What is the correct way of saving multiple selections selected from Django-select2 Widget? this is my model class Rgn_Details(models.Model): request_no = models.ForeignKey(Request_Flow, on_delete=models.CASCADE, related_name='request_ref') region = models.ForeignKey(Region, on_delete=models.PROTECT, related_name='regn') class Meta: ordering= ['-region'] def __str__(self): return self.region I have a model form like this. class RegionForm(forms.ModelForm): region = forms.ModelMultipleChoiceField(queryset=Region.objects.all().order_by('region_id'), widget=Select2MultipleWidget) class Meta: model = Rgn_Details fields = ['region'] this is my view def create(request): if request.method == 'POST': form1 = RequestForm(request.POST, prefix="form1") form2 = RegionForm(request.POST, prefix="form2") if form1.is_valid() and form2.is_valid(): req = form1.save() region = form2.save(commit=False) region.request_no = req region.save() if I try region.save() its not working though form validation have no errors... I am getting Cannot insert the value NULL into column 'region_id', table 'rgn_details' Am I doing something wrong with save method when you have multiple selections with Django-Select2 widget?? Please suggest solution... -
Django Get All Lesson Durations For A Single Course
Similarly to other video based websites, I want to get the the total duration of all the lessons in a single course. My current code was able to get all lesson durations for all courses which is not desirable, the .all() is too much. I keep hearing annotate is the solution but not sure how to implement it myself. Template: {{object.total_duration}} {{object.total_iso_duration}} Models.py: class Course(models.Model): name = models.CharField(max_length=120) def __str__(self): return self.name @property def lessons(self): return self.lesson_set.all().order_by('position') class Meta: ordering = ('name',) @property def total_duration(self): seconds_dictionary = Lesson.objects.all().aggregate(Sum('duration')) sec = seconds_dictionary['duration__sum'].total_seconds() if sec >= 3600: return '%2d:%02d:%02d' % (int((sec/3600)%3600), int((sec/60)%60), int((sec)%60)) #return hh:mm:ss else: return '%2d:%02d' % (int((sec/60)%60), int((sec)%60)) #return mm:ss @property def total_iso_duration(self): seconds_dictionary = Lesson.objects.all().aggregate(Sum('duration')) return to_iso8601(seconds_dictionary['duration__sum']) class Lesson(models.Model): course = models.ForeignKey(Course, on_delete=models.SET_NULL, null=True) duration = models.DurationField(default=timedelta()) def __str__(self): return self.title @property def iso_duration(self): return to_iso8601(self.duration) @property def formatted_duration(self): #To add leading zeros use %02d sec = self.duration.total_seconds() if sec >= 3600: return '%2d:%02d:%02d' % (int((sec/3600)%3600), int((sec/60)%60), int((sec)%60)) #return hh:mm:ss else: return '%2d:%02d' % (int((sec/60)%60), int((sec)%60)) #return mm:ss Views.py: class CourseDetailView(DetailView): model = Course def get(self, request, *args, **kwargs) : response = super().get(request, *args, **kwargs) Course.objects.filter(pk=self.object.pk).update(views=F('views') … -
Django rank search in Postgres not matching
I have a Tutorial model with name 'building'. Here is search. tutorial_search = Tutorial.objects.annotate( rank=SearchRank(SearchVector('name'), query) ).filter(rank__gte=0.0001).order_by('-rank') This query finds my model query = 'bui:*' But this one doesnt query = 'buildi:*' I cant figure out what is causing it. Is it english accent? Seems like simple search. Thanks! -
How do I uninstall dj-stripe from my project?
I ran pip uninstall dj-stripe and removed it from INSTALLED_APPS and removed the other settings.py entries. Everything is working, but the DB still has a lot of dj-stripe tables. Is there a quick way to remove these? I ran migrate to create them, but they are not in my models.py file. They were made with something from the dj-stripe installation. Thank you. -
Django remove Duplicates after filtering from model objects
I have a model called Course , I have been trying to get a list of them using the filter function. Now each course has different fields. My course model is: class Course(models.Model): course_code = models.CharField(max_length=20) course_university = models.CharField(max_length=100) course_instructor = models.CharField(max_length=100) course_year = models.IntegerField(('year'), validators=[MinValueValidator(1984), MaxValueValidator(max_value_current_year())]) course_likes = models.ManyToManyField(Profile, blank=True, related_name='course_likes') course_dislikes = models.ManyToManyField(Profile, blank=True, related_name='course_dislikes') course_reviews = models.ManyToManyField(Review, blank=True, related_name='course_reviews') I am trying to get the courses for instructor named "Smiths" at Oxford university courses = Course.objects.filter(course_instructor="smiths",course_university="university") How can I remove duplicated with this name for instance show the one with the latest year? Sine, for example, there will be course ABC123 by professor Smith in Oxford university in years 2017,2018,2019,... how can I return only one of those? I have tried distinct() but it doesn't work. Is there any way to do that? Or should I change the whole structure of my database? -
Dealing with three django forms inside a page - Django/Python/CSS
i am working in a web app, there is a section in which i would like to show three forms one of them is obligatory to fill and the other two dont, i would like to show them side by side each but i can t find a way, i've been trying as many ways as possible but i can't achieve it, but i will leave the source code with which i started styling this form. HTML {%extends 'base.html'%} {%load staticfiles%} {%block body_block%} <link rel="stylesheet" href="{%static 'patients/css/patientform.css'%}"> <form method="POST" class="box" > {%csrf_token%} <div> <h3>Informacion del Paciente</h3> {{patientinfo.as_p}} </div> <h3>Antecedentes Familiares</h3> <h5>Primer Caso</h5> <div class="FirstRelative"> {{first_relative.as_p}} </div> <h5>Segundo Caso</h5> <div class="Second Relative"> {{second_relative.as_p}} </div> <input id="submit" type="submit" value="Agregar"> </form> {%endblock%} CSS .box{ width: 300px; padding: 40px; position: absolute; margin-top: 100px; background: #191919; text-align: center; } .box input{ border: 0; background: none; display: block; margin: 20px auto; text-align: center; border: 2px solid #3498db; padding: 14px 10px; width: 200px; outline: none; color: white; border-radius: 24px; transition: 0.50s; } .box dropdown{ border: 0; background: none; display: block; margin: 20px auto; text-align: center; border: 2px solid #3498db; padding: 14px 10px; width: 200px; outline: none; color: white; border-radius: 24px; transition: 0.50s; } .box input:focus{ width: 280px; … -
Forms, Model, and updating with current user
I think this works, but I came across a couple of things before getting it to work that I want to understand better, so the question. It also looks like other people do this a variety of ways looking at other answers on stack overflow. What I am trying to avoid is having the user to have to select his username from the pulldown when creating a new search-profile. The search profile model is: class Search_Profile(models.Model): author_of_profile = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,blank=True) keyword_string = models.CharField(max_length=200) other_stuff = models.CharField(max_length=200) The form I ended up with was: class Search_Profile_Form(ModelForm): class Meta: model = Search_Profile fields = [ 'keyword_string', 'other_stuff'] Where I deliberately left out 'author_of_profile' so that it wouldn't be shown or need to be validated. I tried hiding it, but then the form would not save to the model because a field hadn't been entered. If I was o.k. with a pulldown I guess I could have left it in. I didn't have any issues with the HTML while testing for completeness: <form action="" method="POST"> {% csrf_token %} {{ form.author_of_profile}} {{ form.keyword_string }} {{ form.other_stuff }} <input type="submit" value="Save and Return to Home Page"> </form> And the View is where I ended up treating … -
Django testing - ImportError/ModuleNotFoundError
I'm working through the Django tutorial, currently on part 5 — testing, when I go to run the test through the Django shell I keep getting the following error message: (venv) My-MacBook-Pro:mysite Me$ python manage.py test polls System check identified no issues (0 silenced). E ====================================================================== ERROR: mysite.polls (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: mysite.polls Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/loader.py", line 470, in _find_test_path package = self._get_module_from_name(name) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name __import__(name) ModuleNotFoundError: No module named 'mysite.polls' ---------------------------------------------------------------------- Ran 1 test in 0.001s FAILED (errors=1) I'm not really sure what's going on here, the test code is copy and pasted directly out off the Django site. My tree: Mysite Venv -__init__.py -db.sqlite3 -manage.py -Mysite --__init__.py --asgi.py --settings.py --urls.py --wsgi.py -Polls --migrations --template --__init__.py --admin.py --apps.py --models.py --tests.py --urls.py --views.py Thanks for the help. -
HOW TO DISPLAY IMAGES FROM DJANGO MODEL DATABASE IN MODAL POP UP OR LIGHTBOX
I want my lightbox or modal popup to display images from my django model, when the user upload an image to the database, the image is displayed on the webpage as modalpopup or lightbox when clicked, i achieved this by using images on my local drive. but haven't seen any solution online and on youtube for uploaded images. this only shows the first image and blank on as the next image {% extends 'base.html' %} {% load static %} {% block title %} G.F. Cakes {% endblock %} {% block content %} {% include 'nav.html' %} {% for post in post.all %} <link rel="stylesheet" href="{% static 'css/cakes.css' %}"> <div class="main"> <div class="row"> <div class="column"> <div class="content"> <img src="{{post.cake_image.url}}" style="width:100%" onclick="openModal();currentSlide(1)" class="hover-shadow cursor"> <div class="imgcaption"> <h3>{{post.cake_name}}</h3> </div> </div> </div> </div> <div id="myModal" class="modal"> <span class="close cursor" onclick="closeModal()">&times;</span> <div class="modal-content"> <div class="mySlides"> <div class="numbertext">1 / 4</div> <img src="{{post.cake_image.url}}" class="modal-img" style="width:100%"> <!-- <br /><p>{{post.cake_name}}</p> --> </div> <a class="prev" onclick="plusSlides(-1)">&#10094;</a> <a class="next" onclick="plusSlides(1)">&#10095;</a> <div class="caption-container"> <p id="caption"></p> </div> </div> </div> </div> {% endfor %} {% include 'foot.html' %} {% endblock %} my javascrpt code function openModal() { document.getElementById('myModal').style.display = "block"; } function closeModal() { document.getElementById('myModal').style.display = "none"; } var slideIndex = 1; showSlides(slideIndex); function … -
setattr() on class instance does not set value
Python 3, channels 1.x, django 1.11. The game is tron lightcycles but to turn, users must solve a math problem. multiplayer, currently 2 players max generate_first_4_problems_game func (inside channels session - see decorator @channel_session_user) is triggered at the start of a game. it sends the flux_instance to generate_first_4_problems func, which is outside the channels session (I'm not sure if this matters though). Inside generate_first_4_problems, setattr is supposed to set the values (details aren't too important, just know that the relevant (class) attributes are p1/p2-up/down/left/right (8 attributes total) and they store math problems) in the flux_instance that is being used in the channels session but that never happens. Printing getattr(flux_instance,d) (example, flux.p1up = '2 + 8') inside generate_first_4_problems exhibits expected behavior (math problem is printed), but printing inside send_answer gives a None. The focus of this question is inside send_answer, where getattr(flux_instance,d) is supposed to be some math problem, which was supposed to be defined in generate_first_4_problems (and it seems like it was, because the print statement inside of it exhibited expected behavior (a math problem for each getattr(flux_instance, d))), but it is not. Can anyone help? def is_correct_answer(problem_string, input_answer): # determines if input answer is correct for given problem string … -
Sum Foreignkey objects to loop
I'm trying create a table with 2 columns: 1) Collections and 2) Qualified Sales. Like the image above. Each book count the own qualified_sales. The Qualified sales(column in the table) must sum all qualified_sales of all books of each collection. models.py class Publishing_company(models.Model): title = models.CharField(max_length=50) class Collection(models.Model): publishing_company = models.ForeignKey(Publishing_company, on_delete=models.CASCADE) class Book(models.Model): publishing_company = models.ForeignKey(Publishing_company, on_delete=models.CASCADE) class Sale(models.Model): book = models.ForeignKey(Book, on_delete=models.CASCADE) qualified_sale = models.IntegerField(default=0) views.py def qlf_sales(request): book = Collection.objects.filter(user=request.user) qualified_sum = Sale.objects.filter(user=request.user, book__publishing_company__collection__in=book).aggregate(Sum('qualified_sale'))['qualified_sale__sum'] or 0 context = {'qualified_sum': qualified_sum} return render(request, 'template.html', context) template.html {% for collection in collections %} <tr> <td>{{collection}}</td> <td>{{qualified_sum}}%</td> </tr> {% endfor %} But this code not work. Dont appear any debug error, but only the values in the Qualified Sales' column dont appear, it was blank. If anyone can help me. Please i go a lot grateful. -
Field 'id' expected a number but got 'r' - Django form
I have a Django form that creates blog posts, however the form throws Exceptions when submitting. Strangely, however they still create these posts and I can view these on the other page. Here are my models.py, views.py, form.py code and the stack trace. Models.py from django.db import models from django.utils import timezone from django.contrib.auth import get_user_model User = get_user_model() class Author(models.Model): """ Inherits the auth user model """ user = models.OneToOneField(User, on_delete=models.CASCADE) def __str__(self): return self.user.username class Category(models.Model): """ Generic entries so posts can be filtered """ title = models.CharField(max_length=20) def __str__(self): return self.title class News_Post(models.Model): """ Inherits Category & Author Models """ title = models.CharField(max_length=100) content = models.TextField() date_posted = models.DateTimeField(default=timezone.now) date_modified = models.DateTimeField(default=timezone.now) author = models.ForeignKey(Author, on_delete=models.CASCADE) categories = models.ManyToManyField(Category) featured = models.BooleanField() post_img = models.ImageField(default='default.jpg') def __str__(self): return self.title Forms.py: from .models import News_Post from django import forms class News_Post_Form(forms.ModelForm): """ Form responsible for creating new posts. """ id = None content = forms.CharField() categories = forms.CharField() featured = forms.BooleanField() post_img = forms.ImageField() class Meta: model = News_Post fields = [ 'title', 'content', 'categories', 'featured', 'post_img', ] Views.py from django.shortcuts import render, redirect from .models import News_Post, Author from .forms import News_Post_Form from django.contrib.auth.decorators import login_required from … -
Django forms not saving
when I trying to upload a file, the line form.save(), the image is being saved in the /media folder but the webpage is showing me an error (relation "project1_document" does not exist LINE 1: INSERT INTO "project1_document" ("description", "document", ...) my model_form_upload.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <button type="submit">Upload</button> </form> <p><a href="{% url 'home' %}">Return to home</a></p> </body> </html> my models.py class Document(models.Model): description = models.CharField(max_length=255, blank=True) document = models.FileField(upload_to='UserUploads/') uploaded_at = models.DateTimeField(auto_now_add=True) my forms.py from django import forms from .models import Document class DocumentForm(forms.ModelForm): class Meta: model = Document fields = ('description', 'document', ) my views.py here after saving the page is not redirecting to home insted showing me error (ProgrammingError at /model_form_upload) from django.shortcuts import render, redirect from project1.forms import DocumentForm from .models import Document from django.http import HttpResponse from django.core.files.storage import FileSystemStorage from django.views.generic.edit import FormView def model_form_upload(request): if request.method == 'POST': form = DocumentForm(request.POST, request.FILES) if form.is_valid(): form.save(); return redirect('home') else: form = DocumentForm() return render(request, 'model_form_upload.html', { 'form': form }) -
Django annotate returning unexpected Sum value
These are my models: class Consume(models.Model): amount = models.FloatField(default=1) entry_for = models.ForeignKey( Person, on_delete=models.SET_NULL, related_name='consume_entry_for', ) class Purchase(models.Model): amount = models.DecimalField( max_digits=6, decimal_places=2, default=0.00 ) entry_for = models.ForeignKey( Person, on_delete=models.CASCADE, related_name='ledger_entry_for', ) and this is my query: person_wise_total = Person.objects.annotate( total_purchase=Coalesce(Sum('ledger_entry_for__amount'), Value(0)), total_consume=Coalesce(Sum('consume_entry_for__amount'), Value(0)) ) For example, i have an entry in Purchase amount: 2, entry_for: jhon, amount: 3, entry_for: smith amount: 5, entry_for: jhon, amount: 1, entry_for: jhon, and consume entry: amount: 1, entry_for: jhon, amount: 2, entry_for: smith, According to above data, my query Sum should return total_consume for jhon is 1, but it is returning 3 for jhon in total_consume and smith total_consume is 2, here smith result is expected but jhon result is unexpected. I guess, the problem/ wrong calculation occurring because of jhon has 3 entry in the Purchase table, so it is multpliying with total entry of person's purchase and total consume amount, i am not sure why. Can anyone please help me how can i get the correct calculated result? I want, it should return, jhon's total_purchase: 8, total_consume: 1, smith's total_purchase: 3, total_consume: 2 can anyone help me in case? -
Uploading local files remotely
Check out the image below, It is an image for a website i am working on. See the "Browse button", in the image, it is for users to upload files that are located on their pc. Imagine that i am accessing the website remotely "from another computer" and i wanna upload local files. what would be the way to upload local files where the website's source code is located while you are accessing the website remotely. Brows button is basically as that opens up a window to brows local files that are located on whatever computer you access the website from, but not from where that website is located. Thanks in advance. -
Why is my Heroku deployment not recognising my Procfile?
I'm trying to deploy my app using Heroku. I tried via CLI and also graphically in their user portal. I get this problem in the build log: Procfile declares types -> (none) It's not reading my Procfile. Here's some of the latest lines of my error logs: 2020-05-08T04:32:57.546072+00:00 app[api]: Deploy 02e1e06c by user djrgrey@gmail.com 2020-05-08T04:32:57.546072+00:00 app[api]: Release v7 created by user djrgrey@gmail.com 2020-05-08T04:33:05.475821+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=herokudanslist.herokuapp.com request_id=ff88cf27-54c2 -4611-b611-ce36c41b09f6 fwd="118.149.66.76" dyno= connect= service= status=503 bytes= protocol=https 2020-05-08T04:33:06.086210+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=herokudanslist.herokuapp.com request_id=a4 690f93-c8e3-4256-b46b-a8d1e69109c1 fwd="118.149.66.76" dyno= connect= service= status=503 bytes= protocol=https 2020-05-08T04:33:13.000000+00:00 app[api]: Build succeeded 2020-05-08T10:04:32.000000+00:00 app[api]: Build started by user djrgrey@gmail.com 2020-05-08T10:05:04.414084+00:00 app[api]: Release v8 created by user djrgrey@gmail.com 2020-05-08T10:05:04.414084+00:00 app[api]: Deploy 92e0c7b1 by user djrgrey@gmail.com 2020-05-08T10:05:37.245718+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=herokudanslist.herokuapp.com request_id=9cb80bd2-7cb6 -4e20-ad8a-e61aeeab0e02 fwd="118.149.66.76" dyno= connect= service= status=503 bytes= protocol=https 2020-05-08T10:05:39.210072+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=herokudanslist.herokuapp.com request_id=a2 9bf337-c13a-4eb7-83ef-e221bc69b6b7 fwd="118.149.66.76" dyno= connect= service= status=503 bytes= protocol=https 2020-05-08T10:05:40.000000+00:00 app[api]: Build succeeded It's not a text file. I have it in the project root directory. Just to make sure, i copied it into the root directory of that. And the … -
Django making http queries with values that is included in field (not full match)
In my Django REST-API, I can make HTTP query for example: http://example.com/api/article/?descriptions=bitcoin It returns records, where a description is exactly bitcoin. I want to make a query that finds all records where a description includes, in this case, bitcoin word. How to do it? Here is how my view class looks like: class ArticleListAPI(generics.ListCreateAPIView): queryset = Article.objects.all() serializer_class = ArticleListSerializer filter_backends = [DjangoFilterBackend] filterset_fields = ['id', 'article_name', 'descriptions'] -
Repalce the entire Django admin template
I want to replace the entire Django admin template and work with my own. I searched a lot but i found only overriding template which can't satisficate my need. how i can replace the entire admin template ? -
Waipoint.Infinite only loading next page when window is resized
I've been following the tutorial of simpleisbetterthancomplex on how to make an infinite scroll, the problem is that when I scroll to the bottom nothing happens and it will only load the next page when I'm at the bottom and the page is resized or when I open the inspector. This is the template code: {% block articles %} <section class="Posts-Section"> <div class="infinite-container"> {% if page_list %} {% for post in page_list %} {% include 'forum/post_card.html' %} {% endfor %} {% else %} <p>Não há posts</p> {% endif %} </div> {% if page_list.has_next %} <a class="infinite-more-link" href="?page={{ page_list.next_page_number }}">More</a> {% endif %} </section> {% endblock articles %} {% block js %} <script src="{% static 'forum/js/topic_details.js' %}"></script> <script> const infinite = new Waypoint.Infinite({ element: $('.infinite-container')[0] }); </script> {% endblock %} -
Django - ManyToManyField pointing to "self"
I'm trying to get a Django Model to rebuild a tree of "Founders" of a Network Marketing company, but I can't get it to work. What I'm trying to get: Every "Founder" should have a sponsor above him in the matrix (if he's the first, he doesn't!) and as many founders as he want under him (normally 3). Every founder under him should automatically get him as the sponsor. PS: I'm trying to use it with Django Admin My idea: class Founder(models.Model): name = models.CharField('Name', max_length=50) sponsor = models.ForeignKey("self", on_delete=models.PROTECT, blank=True, null=True #...) founders = models.ManyToManyField("self", #what to put here?) I tried to solve it with related names, but I can't get the ManyToManyField to point to the ForeignKey. I also tried different methods, but no one did work for me. :( Also, every time I tried to use it with Django Admin as an Inline, I got the following error: 'myapp.Founder_founders' has more than one ForeignKey to 'myapp.Founder' # I don't understand that, because Founder_founders is a Model created by Django If you could help me, I'd really appreciate it! If you need more clarification, please ask me! ;) PS: I'm pretty new here, so question might not be … -
Django -- Dynamically showing Images that are created daily
(Disclaimer -- This is my first post on stack overflow, so I'm hoping that I explain this well enough for everyone) What I want to accomplish is have an separate application generate graphs that will be placed in a directory of my Django project. Then in my template loop through and display all the graphs from that directory on the webpage. The generated graphs will be refreshed daily and will be of varying numbers depending on the day (so some days it could be 20 and/or the next it could be 50). Option 1) I don't think I want to use django manage.py collectstatic everyday. I've never gotten to the point of deploying a Django project to a server but my assumption is that I would have to collectstatic manually everyday on the server (which I could be thoroughly off on here) Option 2) I've tried creating a model Model Picture. The Char field is just my relative path to the picture. From there in my views I'm to rendering the path in the index(request) View Picture. From there in my template I'm trying to loop through the picture relative paths and show them Template Picture. When I remove photos … -
How is django rest framework utilized?
When is it required to use Django rest framework? For example if I need to use complicated Form methods, that would be complex for normal Django. -
Integrate okta with Django admin login form
I am trying to add okta OIDC integration in one of my Django sites. The site has 2 apps and these apps are using admin views only and we are not using any custom view. I want to allow users to log in from the default Django login form using Okta validation (preferably OIDC). I checked many articles and modules but I am not able to get it done because of the lack of examples available for the modules especially for beginners. Below are some modules which I tried to use but either it is a lot complicated or it needs a different login page than the Django default login page. django-oidc-provider django-admin-sso pyoidc mozila-django-oidc drf-oidc-auth Either these plugins do not support Django login form as an input form or I am not using the right plugin. Any help is appreciated.