Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Check empty field value in ajax and django
In my project I am using Ajax to save record because I do not want to load the page for new record. But with below code I want to include the way the I can check the empty value and when some field is empty the record should not be saved. I also want the message informing that the record is saved after the progress bar. Below is the code I am currently use. <script> $(".submit_btn").click(function(){ var form=new FormData($("#ReportForm")[0]); //AJAX CODE var xhr=new XMLHttpRequest(); xhr.onreadystatechange=function(){ if(xhr.status==200){ console.log(xhr.responseText); } } xhr.open("POST","{% url 'report_template_create' %}",true); $("#progressbar").show(); //UPDATING PROGRESS BAR xhr.upload.addEventListener("progress",function(ev){ if(ev.lengthComputable){ var percentage=(ev.loaded/ev.total*100|0); $("#progressbar").css({"width":""+percentage+"%"}).text("Uploading .."+percentage+"%"); console.log(percentage); if(percentage>=100){ location.reload() } } }); xhr.send(form); }) -
Django permissions According to branch ID
I have permissions according branch_id. For example if I have two branches with ids 1 and 2. Also,add,change,view and delete the permissions in every models will be: add_model_name_1,add_model_name_2,change_model_name_1,change_model_name_2 and so on So at increase the branches the performance will be slower and slower. What the best solution for this dilemma. Can I copy authentications apps from Django library to my projects and make foreign key from branch models in permissions models. If I take this in considerations. May I will lose the future update for Django, base to that I need to customize other library that depends on Django permissions likes Django guardian. What about indexes , Could it solve a problems. if it could, How can I make index for Django permissions model. the answer to this question return us to customize Django permissions. who is agree with me make issues for this dilemma. Also who have another solution. -
Path issues in django
I am facing a path issue where after clicking "Login" button which is in /login/ path it looks out for /login/login/ , whereas after clicking the "Login" button I want to return it to my root path. I am attaching the snippets of the code and the snaps, please if somebody comes out with a solution do help. "signup.html file" <form action="signup/" method="post"> {% csrf_token %} <input class="text" type="text" name="username" placeholder="Username" required=""> <input class="text email" type="email" name="email" placeholder="Email" required=""> <input class="text" type="password" name="password1" placeholder="Password" required=""> <input class="text w3lpass" type="password" name="password2" placeholder="Confirm Password" required=""> <input class="text" type="text" name="address" placeholder="Address" required=""> <!-- <div class="wthree-text"> <label class="anim"> <input type="checkbox" class="checkbox" required=""> <span>I Agree To The Terms & Conditions</span> </label> <div class="clear"> </div> </div> --> <input type="submit" value="SIGNUP"> </form> "login.html file" <form action="login/" method="post"> {% csrf_token %} <input class="text" type="text" name="username" placeholder="Username" required=""> <input class="text" type="password" name="password" placeholder="Password" required=""> <input type="submit" value="LOGIN"> </form> "urls.py file" urlpatterns = [ path('',views.signup, name='signup'), path('signup/',views.signup,name='signup'), path('login/',views.login,name='login'), ] "views.py file" from django.shortcuts import render,redirect from django.http import HttpResponse from .models import SignUp from django.contrib.auth.models import auth # Create your views here. 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: … -
python string variable changes '\b' into '\x08' and '\a' into '\x07' and similarly for some number and characters too? why?
when I am using -> filename="media\documents\dog_bark.wav" the python works fine and my intended functionality works but with -> filename="media\documents\afile1.wav", filename="media\documents\732-20.wav" and similar other selected filepath it's changing the first character of filename to some x07, x08 and so on why does this happen and any solution of this? Thank You! -
Chat web application using video ,audio and text for communication
I want to develop a website in which users can have video chat and they can connect to other user anonymously without had been added by the other person as friend. I also want that all the active users list is displayed on the website. So somebody please suggest me how can I implement it on django on the back end and react on the frontend? -
ModuleNotFoundError: no module name 'mysite.settings'
I have been trying to deploy my django project on heroku and have been butting my head against this error for a week. everything runs fine locally but when i push to heroku, all i get is an application error with this information in heroku logs --tail 2021-06-12T04:09:09.270161+00:00 heroku[web.1]: State changed from crashed to starting 2021-06-12T04:09:12.000000+00:00 app[api]: Build succeeded 2021-06-12T04:09:17.474951+00:00 heroku[web.1]: Starting process with command `gunicorn mysite.mysite.wsgi` 2021-06-12T04:09:20.249454+00:00 app[web.1]: [2021-06-12 04:09:20 +0000] [4] [INFO] Starting gunicorn 20.1.0 2021-06-12T04:09:20.250347+00:00 app[web.1]: [2021-06-12 04:09:20 +0000] [4] [INFO] Listening at: http://0.0.0.0:48385 (4) 2021-06-12T04:09:20.250492+00:00 app[web.1]: [2021-06-12 04:09:20 +0000] [4] [INFO] Using worker: sync 2021-06-12T04:09:20.255741+00:00 app[web.1]: [2021-06-12 04:09:20 +0000] [8] [INFO] Booting worker with pid: 8 2021-06-12T04:09:20.275136+00:00 app[web.1]: [2021-06-12 04:09:20 +0000] [9] [INFO] Booting worker with pid: 9 2021-06-12T04:09:20.462240+00:00 app[web.1]: [2021-06-12 04:09:20 +0000] [8] [ERROR] Exception in worker process 2021-06-12T04:09:20.462242+00:00 app[web.1]: Traceback (most recent call last): 2021-06-12T04:09:20.462243+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker 2021-06-12T04:09:20.462243+00:00 app[web.1]: worker.init_process() 2021-06-12T04:09:20.462244+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py", line 134, in init_process 2021-06-12T04:09:20.462244+00:00 app[web.1]: self.load_wsgi() 2021-06-12T04:09:20.462245+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi 2021-06-12T04:09:20.462245+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2021-06-12T04:09:20.462245+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi 2021-06-12T04:09:20.462246+00:00 app[web.1]: self.callable = self.load() 2021-06-12T04:09:20.462246+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in load 2021-06-12T04:09:20.462247+00:00 app[web.1]: return self.load_wsgiapp() … -
Setting Font-Family (Django + Bootstrap)
Currently have the following CSS stylesheet which should apply Courier New to a, p, h1, h2, etc... a, p, h1, h2, h3, h4, h5, h6 { font-family: "Courier New"; color: #54627B; } My a tags are showing as Courier New. However, the Font-Family for my h1 are not. They are showing up as: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji" It looks like Bootstrap is overriding the Font Family (even though it should not; my custom stylesheet is declared after the Bootstrap one) <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <link rel="stylesheet" href="{% static 'blog_post_app/base.css' %}"> -
django model instance value set to none after the loop
Here, in the rename_dfs function, I am getting the Documents_details model instance and setting its corresponding fields inside the loop. Inside the for loop, some instance field values are getting set, but after the for loop, the instance field value automatically set to None. def rename_dfs(documentId, request): doc_details = Documents_details.objects.get(id=documentId) for key, value in request.items(): if request[key] and key != 'csrfmiddlewaretoken': if re.search("_a$", key): doc_details.key = int(value) print(key, doc_details.key) if re.search("_b$", key): doc_details.key = int(value) print(key, doc_details.key) print(doc_details.document_date_a) doc_details.save() Output: document_date_a 7 invoice_no_a 5 invoice_type_a 3 narration_a 2 debit_credit_a 1 document_date_b 5 invoice_no_b 4 invoice_type_b 3 narration_b 2 debit_credit_b 1 None # last print statement after the loop Model: class Documents_details(models.Model): company_name_a = models.CharField(max_length=50) document_date_a = models.IntegerField(null=True, blank=True) posting_date_a = models.IntegerField(null=True, blank=True) invoice_no_a = models.IntegerField(null=True, blank=True) invoice_type_a = models.IntegerField(null=True, blank=True) narration_a = models.IntegerField(null=True, blank=True) debit_a = models.IntegerField(null=True, blank=True) credit_a = models.IntegerField(null=True, blank=True) debit_credit_a = models.IntegerField(null=True, blank=True) company_name_b = models.CharField(max_length=50) document_date_b = models.IntegerField(null=True, blank=True) posting_date_b = models.IntegerField(null=True, blank=True) invoice_no_b = models.IntegerField(null=True, blank=True) invoice_type_b = models.IntegerField(null=True, blank=True) narration_b = models.IntegerField(null=True, blank=True) debit_b = models.IntegerField(null=True, blank=True) credit_b = models.IntegerField(null=True, blank=True) debit_credit_b = models.IntegerField(null=True, blank=True) documents = models.ForeignKey(Documents, on_delete=models.CASCADE) Thanks in advance -
What is the recommended configuration for two web apps served by Apache Virtual Hosts in AWS VPC?
I have a VPC with one public and one private subnet. The idea is having a website and REST API in the public subnet (EC2 instance) and have the RDS MySQL instance in the private subnet. Currently I have my website running with a specific domain (with its own virtualhost config) but I'm not sure how to procede with the API deployment and its own config. Should the ServerName be the private EC2 IP address? I've have never done this and would like to know a recommended approach. -
How can I pass input field value to function in views.py file
I am trying to update my password.For that email-id ,new password and confirm new password values are passed to views.py function by POST method.But POST method does not pass any value to views.py function.Also I tried to validate the form using JAVASCRIPT,but I failed to do that.How can I rectify this problem.Can anyone help? HTML file: <!DOCTYPE html> <html lang="en"> {% load static %} <head> <meta charset="UTF-8"> <title>Password Reset</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <link href="{% static 'styles/style.css' %}" rel="stylesheet"/> </head> <body> <section class="sflog" id="sflog"> <div class="container-fluid"> <div class="row"> <div class="col-12" id="std"> <form method="POST" name="forgot" action="{% url 'ufpasswordreset' %}"> {%csrf_token%} <center> <h3>Password <span>Reset</span> Form</h3><br> </center> <label style="color:white;padding-left:13%;">Enter Your Registered Email</label> <center> <input type="email" id="email" name="email" placeholder="Email"><br><br> <span id="lemail"></span> </center> <label style="color:white;padding-left:13%;">Enter New Password</label> <center> <input type="password" id="pass" name="pass" placeholder="New Password"><br><br> <span id="lpass"></span> </center> <label style="color:white;padding-left:13%;">Confirm New Password</label> <center> <input type="password" id="cpass" name="cpass" placeholder="Confirm New Password"><br><br> <span id="lcpass"></span> </center> <center> <button type="submit" name="submit" onclick="return reset()">Submit</button><br><br><br><br> </center> </form> </div> </div> </div> </section> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="{% static 'js/scriptfunction.js' %}"></script> </body> </html> views.py def user_forgot_password_reset(request): if request.method == 'POST': print("hi") femail = request.POST.get('email') print(femail) fpassword = request.POST.get('pass') print(fpassword) fepassword = sha256(fpassword.encode()).hexdigest() fcpassword = … -
How to create a web app that deploys AI in the back end?
So I've created an AI model that analyzes music and tries to figure out what notes are played in Python. I want to create a web-app like this: https://piano2notes.com/en The web-app mentioned above allows a user to upload a song or link a song from YouTube and then some AI magic happens in the background. How could I create this? I'm still kinds new to making web apps but from the research I have done I've come to the conclusion that this is what I should use: React for front-end and UI Django for back-end Firebase for database Do these technologies 'fit' for what I am trying to do? Thanks in advance :) -
python: if condition, it is very simple calculation, but it does not work
I wrote very simple calculation function as below; def price_cal(): if direction == 'A' and (int(no_of_passenger) == 1): return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) elif direction == 'A' and (1 < int(no_of_passenger) <= 9): return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) - 10 elif direction == 'A' and (9 < int(no_of_passenger) <= 13): return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) + 20 elif direction == 'B' and (int(no_of_passenger) == 1): return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) + 10 elif direction == 'B' and (1 < int(no_of_passenger) <= 9): return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) else: return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) + 20 price_cal() When I run this function, only I get right answers from the first if direction == 'A' and (int(no_of_passenger) == 1): return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) the rest of them, I get only answers from the last function else: return int(suburbs.get(suburb)) + (int(no_of_passenger) * 10) + 20 I don't know why this happen... please correct this simple function, much appreciated -
How to set filter attributes in __init__
I know how to set the attributes for form fields with something like class CaseRegistrationForm(ModelForm): ... def __init__(self, *args, **kwargs): ... self.fields["subject"] = forms.ModelMultipleChoiceField( queryset=Subject.objects.all(), widget=forms.CheckboxSelectMultiple, ) How do I do the equivalent for filters? I have tried something similar for filters: class CaseFilter(django_filters.FilterSet): ... def __init__(self, *args, **kwargs): ... self.fields["subject"].label = "Role:" but 'CaseFilter' object has no attribute 'fields' -
Python Django: AttributeError: 'int' object has no attribute 'timetuple'
Quick note: this error may be somewhat linked to this thread, but the use case and python version (the other one is still at v2) is different. Other similar threads don't regard specifically to python datetime. I have the following code: import datetime from .models import RaceData, RacerData @periodic_task(crontab(minute='*/15')) def record_racedata(): team = nitrotype.Team('PR2W') timestamp = datetime.datetime.now() # timestamp for members in team.data["members"]: rcd = RaceData( timestamp=timestamp, ) rcd.save() @periodic_task(crontab(minute='*/15')) def record_racerdata(): timestamp = datetime.datetime.now() # timestamp for members in team.data["members"]: rcrd = RacerData( timestamp=timestamp, ) rcrd.save() # error comes from here models: class RaceData(models.Model): id = models.BigAutoField(primary_key=True) timestamp = UnixDateTimeField() class RacerData(models.Model): id = models.BigAutoField(primary_key=True) timestamp = UnixDateTimeField() And I get the following output: AttributeError: 'int' object has no attribute 'timetuple' What confuses me the most is how the first inclusion of timestamp doesn't come with an error, but maybe the execution doesn't go from top to bottom. Either way, I believe that I've initialized the timestamp variable appropriately. Can anyone please help? Note that I cannot define timestamp outside either function because I need the timestamp to be constantly updated with the periodically-called functions. EDIT I've seen elsewhere that this error occurred because the namespace datetime was used … -
Is there a way to merge the results of many QuerySets into a single QuerySet in Django?
I have a list of QuerySets (qs1, qs2, ..., qsn), whose length is not fixed (it varies depending on other variables). I need to merge all those QuerySets into a single QuerySet. I have something like this: list1 = [qs1, qs2, ..., qsn] I know there's a function in Django that allows me to do just this, but only if I know exactly how many QuerySets I want to join. Since in this case the number of QuerySets in the list (the ones that I want to merge) varies, I can't use qs1.union(qs2, qs3) because I won't always have just those three QuerySets in my list, sometimes I'll have just one or just two, or a thousand. Knowing that the length of the list is not fixed and that I need a final QuerySet that includes the results of all of the QuerySets within the list list1, no matter how many QuerySets it contains, is there a function that allows me to merge all the QuerySets inside this list into a single QuerySet? Thanks so much in advance. -
Sync a local firebird database with online Django database
So I have a sales software on my desktop based on firebird database so I want to build a website using Django syncing with the firebird database Is there any way to do it ? If there is show me the guidelines please it's really important for me Thanks I appreciate any help -
Error for start script when trying to deploy Django-React with Heroku
I am trying to deploy my first ever application, which has django for the backend and react for the frontend (with create-react-app). I followed the steps in some tutorials and managed to get my deploy build running but I am getting an error for npm start. I can't seem to find any solution, any help will be more than welcomed. 2021-06-11T21:48:08.784605+00:00 heroku[web.1]: State changed from crashed to starting 2021-06-11T21:48:22.000000+00:00 app[api]: Build succeeded 2021-06-11T21:48:25.830113+00:00 heroku[web.1]: Starting process with command `npm start` 2021-06-11T21:48:28.292792+00:00 app[web.1]: 2021-06-11T21:48:28.292815+00:00 app[web.1]: > ui@0.1.0 start /app 2021-06-11T21:48:28.292815+00:00 app[web.1]: > serve -s build 2021-06-11T21:48:28.292815+00:00 app[web.1]: 2021-06-11T21:48:28.297425+00:00 app[web.1]: sh: 1: serve: not found 2021-06-11T21:48:28.304774+00:00 app[web.1]: npm ERR! code ELIFECYCLE 2021-06-11T21:48:28.305084+00:00 app[web.1]: npm ERR! syscall spawn 2021-06-11T21:48:28.305267+00:00 app[web.1]: npm ERR! file sh 2021-06-11T21:48:28.305429+00:00 app[web.1]: npm ERR! errno ENOENT 2021-06-11T21:48:28.309100+00:00 app[web.1]: npm ERR! ui@0.1.0 start: `serve -s build` 2021-06-11T21:48:28.309179+00:00 app[web.1]: npm ERR! spawn ENOENT 2021-06-11T21:48:28.309293+00:00 app[web.1]: npm ERR! 2021-06-11T21:48:28.309384+00:00 app[web.1]: npm ERR! Failed at the ui@0.1.0 start script. 2021-06-11T21:48:28.309470+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 2021-06-11T21:48:28.315822+00:00 app[web.1]: 2021-06-11T21:48:28.316160+00:00 app[web.1]: npm ERR! A complete log of this run can be found in: 2021-06-11T21:48:28.316161+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-06-11T21_48_28_310Z-debug.log 2021-06-11T21:48:28.376386+00:00 heroku[web.1]: Process exited … -
How can I shorten the full path to the file, to the name of the file in djano admin forms?
I have a standard Django admin form. When the file is uploaded in the file selection box, I would like to leave only the file name, instead of the full path in the static. Is this possible without editing the template, but only by overriding a formset, form, or model methods? In the picture above the button, change the display of the line "ws_document_studygroup/2021/2/123123123123123123png" to "123123123123123123png". But without changing the real path in the model. Please advise the best practice. -
How to handle API requests checking for the same key in Redis
I have been working with solution where I receive more than 100 requests for the same process at the same time (with a time diff of 1-2 milliseconds). In-order to process only one request and discard all, I have been setting a key common to all the requests in redis and check for this key in the second and other subsequent transactions, if found, should not progress further. What I observed is, since the transactions are coming in real time, by the time the first transaction sets the key, the second transaction executes as it dose not find the key in redis. What is the best way to solve this?. -
?Django - how do I select a different static file to use depending on user input in sessions?
Hopefully third time's a charm. I'm creating a Django website where users (who are learning Chinese) can upload Chinese vocabulary lists and the site will return a list of just the unique characters (no duplicates) that the user can download. So far, it's working and doing everything I described above. But the part that I'm stuck on is that I want to add a filter functionality. I want to add the option to exclude some of the more common Chinese characters from the list that the user downloads (what I'm thinking of as a filter feature). I have created a dropdown menu where before the user presses upload, they first say whether they want to filter out the 100 most common characters, 500, none, etc. Then, they move to another page where it should take that into account when it's writing to the file that it presents for the user to download. The logic of what I want to achieve would be something like: if the user selects one FilterPreference, then the web app should use the corresponding file in static files to filter out the characters in that file from the final output. I am fairly sure that I … -
How do I retrieve a user response token for reCAPTCHA in django?
I try to implement reCAPTCHA for my django website and I'm stuck at retrieving the users response token. Google docs says: Retrieve the user's response token from the web pages in one of following ways: The resolved value of the promise returned by the call to grecaptcha.enterprise.execute(). g-recaptcha-response POST parameter when a user submits the form on your site. As a string argument to your callback function if data-callback is specified in either the g-recaptcha HTML tag attribute or the callback parameter in the grecaptcha.enterprise.render method. truble is, that I don't know how to go about to do any of those three things. Can anyone give me a hint how to get that response token once someone submits the form and save it in a variable to use it in django? The form is something like this: <form id="contact-form" method="POST" action="{% url 'send_email' %}"> <a name="contact"></a> <label>Name</label> <input required class="input-field" type="text" name="name"> ... <label>Captcha:</label> <div class="g-recaptcha" data-sitekey="6Le..."></div> <input id="submit-btn" type="submit" value="Send"> </form> -
Check if value exists in firebase DB with Django
I have the following structure in my Firebase DB: { "users": { "-KKUmYgLYREWCnWeHCvO": { "fName": "Peter", "ID": "U1EL9SSUQ", "username": "peter01" }, "-KKUmYgLYREWCnWeHCvO": { "fName": "John", "ID": "U1EL5623", "username": "john.doe" } } } I want to check if ID with value U1EL5623 exists using Django. all_users = db.child('users').get(user['idToken']) for user in all_users.each(): if user.ID == "U1EL9SSUQ": print(user.username) And i have this error 'Pyre' object has no attribute 'ID' Regards./ -
Django rest framework value from data variable
I'm trying to create API that will get post request with the ('command', 'name', 'APIToken') variables. After that I need that the API will execute local python script with those variables but I can't find a way to extract those values from the request. Any suggestions ? -
Django self.request.POST.get() returning None
I am trying to create a search button for my database. But my self.request.POST.get('searched') is returning None the form: <form class="d-flex" action="{% url 'asset_app_search' %}">{% csrf_token %} <input class="form-control me-2" type="search" placeholder="Søg" aria-label="Search" name="searched"> <button class="btn btn-outline-secondary" type="submit">Søg</button> - </form> my views.py class SearchView(generic.TemplateView): template_name = "asset_app/search.html" def post(self): searched = self.request.POST.get('searched') def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) searched = self.post() context['searched'] = searched context_entry_today = datetime.date.today() context_entry_overdue = datetime.date.today() - datetime.timedelta(days=90) context_entry_inspection_time = datetime.date.today() - datetime.timedelta(days=76) context['assets'] = models.Asset.objects.order_by('name') context['rooms'] = models.Room.objects.order_by('last_inspected', 'location', 'name') context['bundelReservations'] = models.Bundle_reservation.objects.order_by('return_date') context['loan_assets'] = models.Loan_asset.objects.order_by('return_date') context['to_dos'] = to_do_list_app.models.Jobs.objects.all() context['today'] = context_entry_today context['overdue'] = context_entry_overdue context['inspection_time'] = context_entry_inspection_time return context and what is beeing posted [11/Jun/2021 22:55:23] "GET /asset/search/?csrfmiddlewaretoken=fqb8jppygSbZ10ET8AXw6dd5B77z5OYudNJU0uyjp8jFNYDG57nkNvrcx5lHFsPo&searched=sdfdsff HTTP/1.1" 200 10418 -
How do I use another website's login system to authenticate my users?
I am trying to build an app with Django and React, and I would like to use this login flow: User goes to my app's login page Once they are on my app's login page, they click a button that redirects them to another website's login page Important note: I do NOT want to use Google, Facebook, or any other social provider for this authentication. I want to use a specific website Once the user has logged in on that website, they are redirected to the pages on my website that require authentication I have looked into SSO and its various solutions to solve my problem, but it is a bit convoluted - does anyone have any advice to send me down the correct, general direction?