Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
I can not find the solution when it comes to CRISPY FORMS
IN MY DJANGO PROJECT I AM GETTING THIS EXCEPTION File "", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'crispy_formsmyapp -
Django. How to get profile picture url google Oauth2 api
how can I get a google profile picture with Oauth2 authorization settings.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'djoser', 'accounts.apps.AccountsConfig', 'social_django', 'rest_framework_simplejwt', 'rest_framework_simplejwt.token_blacklist', 'blog' ] SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = ['https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'openid'] SOCIAL_AUTH_GOOGLE_OAUTH2_EXTRA_DATA = ['first_name', 'last_name', 'fullname', 'username', 'picture'] models.py class UserAccount(AbstractBaseUser, PermissionsMixin): email = models.EmailField(max_length=255, unique=True) first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) picture = models.URLField(blank=True) fullname = models.CharField(max_length=100) username = models.CharField(max_length=100) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) objects = UserAccountManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['first_name', 'last_name', 'fullname', 'picture', 'username'] returns all fields except picture during authorization -
How to save a model field having many to many realtionship with another model so that it will update the value automatically on another model?
I am having a model name 'tag' which has field name talent which has many to many relationship field with model name 'talent'. now I want to update the talent field and save it and it should update the talent model's tag field. I'm new in django. Please help me to find the solution for it. here's the code: tag.py from django.db import models from django.utils.translation import gettext as _ from fotoleybend.mixin import ( IsActiveAndVerifiedMixin, PrimaryKeyMixin, TimeStampMixin, ) from talent.models.talent import Talent class Tag(PrimaryKeyMixin, TimeStampMixin, IsActiveAndVerifiedMixin): """Tag model""" tag = models.CharField(unique=True, max_length=105, db_index=True) talents = models.ManyToManyField( "talent.Talent", blank=True, verbose_name=_("Tag Talents"), related_name="tag_talents", ) class Meta: ordering = ["tag"] def __str__(self): return self.tag talent.py from django.db import models from django.utils.translation import gettext as _ from fotoleybend.mixin import ( IsActiveAndVerifiedMixin, PrimaryKeyMixin, TimeStampMixin, ) class Talent(PrimaryKeyMixin, TimeStampMixin, IsActiveAndVerifiedMixin): """Talent model""" talent = models.CharField(unique=True, max_length=155, db_index=True) is_primary = models.BooleanField( verbose_name=_("Primary"), default=True, db_index=True ) tags = models.ManyToManyField( "talent.Tag", blank=True, verbose_name=_("Talent Tags"), related_name="talent_tags", ) class Meta: ordering = ["talent", "is_primary"] def __str__(self): return self.talent -
Django database modeling
I have a scenerio for which im trying to create the database models but I'm not able to find a perfect way to do it Scenerio is as follows . let's say there is a company which gives offer on his(companies own site) site and a different offer on other site(like Amazon) I want to store company details for which I did something as below. Next I have created the Direct Offers Last I have created Vendors offer All the models are as below class Company(models.Model): name= models.CharField(max_length=50, null=True) address= models.CharField(max_length=250, null=True) class DirectOffers(models.Model): Smartphone= models.FloatField(max_length=50, null=True) class VendorsOffers(models.Model): Smartphone= models.FloatField(max_length=50, null=True) category = models.CharField(max_length=250, null=True) owner = models.ForeigKeyField("Company",on_delete=models.CASCADE) But the above doesn't seems right So any help or guidance will be a great help. -
Django websocket and webrtc
I have made a Video Confrencing Application using django websocket and WebRTC and hosted on heroku.I am using channel_layer conneted with radis lab.And when i try to connect with two seprate window operating system and they get connected but when i tried the same with mac and windows my websockt tries to connect but failed. js console.log("working"); function createMenuItem(name) { let li = document.createElement('li'); li.textContent = name; return li; } const menu = document.querySelector('#menu'); window.onbeforeunload = function() { return "Are you sure?"; }; var labelUsername=document.querySelector('#label-username'); var usernameInput=document.querySelector('#username'); var btnJoin=document.querySelector('#btn-join'); var count; var username; var mapPeers={}; var webSocket; function webSocketOnMessage(event){ var parsedData= JSON.parse(event.data); var peerUsername = parsedData['peer']; var action = parsedData['action']; if(username==peerUsername){ return; } var receiver_channel_name = parsedData['message']['receiver_channel_name'] if(action == 'new-peer'){ createOfferer(peerUsername,receiver_channel_name); return; } if(action == 'new-offer'){ var offer=parsedData['message']['sdp']; createAnswerer(offer,peerUsername , receiver_channel_name); return; } if(action=="new-answer"){ var answer = parsedData['message']['sdp']; var peer = mapPeers[peerUsername][0]; peer.setRemoteDescription(answer); return; } console.log('message',message); } btnJoin.addEventListener('click',() =>{ username=usernameInput.value; console.log('username :' ,username); if(username=="") { return; } usernameInput.value=""; usernameInput.disabled=true; usernameInput.style.visibility= 'hidden'; btnJoin.disabled=true; btnJoin.style.visibility='hidden'; var labelUsername = document.querySelector('#label-username'); labelUsername.innerHTML=username; var loc =window.location; var wsStart='ws://'; if(loc.protocol=='https:'){ wsStart= 'wss://'; } var endPoint = wsStart +loc.host + loc.pathname; console.log('endPoint:',endPoint); webSocket=new WebSocket(endPoint); webSocket.addEventListener('open',(e)=> { console.log("open"); sendSignal('new-peer',{}); }); webSocket.addEventListener('message',webSocketOnMessage); webSocket.addEventListener('close',(e)=> { console.log("close") }); webSocket.addEventListener('error',(e)=> { console.log("error") … -
PermissionError: [Errno 13] Permission denied: '/var/log/gunicorn.error.log'
I have a Django app and I want to deploy it in docker but I got the error PermissionError: [Errno 13] Permission denied: '/var/log/gunicorn.error.log'. I have no idea anymore where the problem is. could someone help me, please? My dockerfile: # BUILDER # ########### # pull official base image FROM python:3.9.6-slim as builder # set work directory WORKDIR /app # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # install system dependencies RUN apt-get update \ && apt-get install -y build-essential python3-dev python2.7-dev \ libldap2-dev libsasl2-dev libssl-dev ldap-utils tox \ lcov valgrind \ && apt-get -y install gcc \ && apt install -y netcat # install psycopg2 dependencies RUN apt-get install -y postgresql-server-dev-all musl-dev # lint RUN pip install --upgrade pip COPY . . # install python dependencies COPY requirements.txt . RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt # pull official base image FROM python:3.9.6-slim RUN apt-get update && apt install -y netcat # create directory for the app user RUN mkdir -p /home/app # create the app user RUN addgroup --system --disabled-password app && adduser --system --group --disabled-password app # RUN addgroup --system app && adduser --system --group app # RUN adduser --disabled-password --gecos '' app … -
Update in DB column vlaues using django script
I have to update in DB table column name batch_status for which I have written the SQL query here UPDATE farm_management_batch set batch_status = "running" where start_date < now() and batch_status = "to_start" UPDATE farm_management_batch set batch_status = "completed" where batch_status IN ('to_start', 'running') and expected_delivery_date < now() But now I want to write a Django script for this which I have no idea how to do it Here Is the Screenshot -
How to join 2 tables in django ORM
I have 2 Tables. TableA and TableB. id is the primary key in TableB and the foreign key in TableA. My task is to find all the items from TableB where the id should match the item_ids. I am able to get all the items with the below queries. But I'd like to understand how to apply joins on the both tables using select_related to get the same result. item_ids = list(TableA.objects.filter(is_active=True).\ distinct().\ values_list('item_id', flat=True)) items = TableB.objects.filter(Q(id__in=item_ids) & \ Q(display_name__isnull=False) & \ Q(name__isnull=False)).\ values("name", "display_name") Could someone help me with the query? -
Is there a way to mock the firebase_admin credentials.Cerificate class in Django?
In my project, FirebaseAuthentication is used and while running the test cases(pipenv run python manage.py test) I am getting the following error - ValueError: Invalid certificate argument: "None". Certificate argument must be a file path, or a dict containing the parsed file contents. authentication.py from firebase_admin import auth from firebase_admin import credentials cred = credentials.Certificate(os.getenv('FIREBASE_ADMIN_KEY_PATH')) default_app = firebase_admin.initialize_app(cred) tests.py(where I have not imported authentication file) from django.test import TestCase class A(TestCase): .... I am trying to run specific app test case but somehow it is trying to import authentication.py. That is why cred = credentials.Certificate(os.getenv('FIREBASE_ADMIN_KEY_PATH')) is getting executed. I have identified that cred and default_app are declared at global level. And I cannot move it to other function or classes for the same file. I have noticed that cred = credentials.Certificate(os.getenv('FIREBASE_ADMIN_KEY_PATH')) returns the object and not specific data and also calls the Firebase API for authentication. How can I mock this two line at a global level? -
How to do multiple or chained filter functionality dynamically in Django?
context_processors.py def menu_categories(request): subcategories= SubCategory.objects.all() return {'subcategories': subcategories} template {% for subcategory in subcategories%} <li><a href="{{ subcategory.get_url }}">{{ subcategory.title|title}}</a></li> {% endfor %} views.py def products_list(request, subcategory_slug=None, brand_slug=None): if subcategory_slug != None: ----------some filter elif brand_slug != None: ----------some filter else: products = Product.objects.all() context = {'products' : paged_product} return render(request, 'product/products_list.html',context) models.py class Product(DateTimeModel): maincategory = models.ForeignKey(MainCategory, null=True, on_delete=models.CASCADE) productcategory = models.ForeignKey(ProductCategory, null=True,on_delete=models.CASCADE) subcategory_slug = models.SlugField(max_length=300, unique=False, null=True,blank=True) product_slug = models.SlugField(max_length=300, unique=False, null=True, blank=True) ------- ------- def get_url(self): return reverse('product:product_details', args=[self.subcategory_slug, self.product_slug]) I am getting this. I need like this multiple select checkbox filter. It should be done dynamically after the product was added by the vendor. Now, I am done with the single filter results. But, I need to achieve multiple chained filters. Don't know how to do it. Please needed help. -
django jwt "detail": "Authentication credentials were not provided."
I am trying to implement jwt token authentication in my Django Rest Framework application. I am able to receive a token from the django server as you can see POSTMAN request but when I try to get user profile, I got this error. Does anyone have idea?? { "detail": "Authentication credentials were not provided." } I could get access token as you can see. This is SIMPLE_JWT setting in settings.py SIMPLE_JWT = { 'ACCESS_TOKEN_LIFETIME': timedelta(hours=1), 'REFRESH_TOKEN_LIFETIME': timedelta(days=3), 'AUTH_HEADER_TYPES': ('JWT', ), 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken', ) } This is app/urls.py urlpatterns = [ path("admin/", admin.site.urls), path("api/", include("user.api.urls")), path('api/auth/', include('djoser.urls')), path('api/auth/', include('djoser.urls.jwt')), ] This is app/user/urls.py router = DefaultRouter() router.register("api/auth/users/", TraineeRegisterApiView) urlpatterns = [ path('profile/', TraineeProfileApiView.as_view({'get': 'retrieve'})) ] -
Including custom Python module with heroku app?
I've included my python module in my app as follows -myapp -mymodule -__init__.py -setup.py -migrations -template -etc... and to the requirements.txt file. During build, the module is installed along with everything else in requirements, which I believe puts mymodule in brython_stdlib.js, because I am also using brython. The logs confirm the module is installed, but not where. Successfully built mymodule However, when I go to import the module, I get an error. According the the logs I can see that the client is making ajax calls looking for the file. Not Found: /mymodule.py Not Found: /mymodule/__init__.py Not Found: /static/django_brython/js/Lib/site-packages/mymodule.py ... and so on. (I've edited out a lot of lines here, but you get the idea!) So what I think is happening is that the client is not finding the module, and is asking for it from the server. But I can put a mymodule.py in my app and it still does not find it. Of course I would rather not serve ajax calls for this since it should already be installed along with everything else in the requirements file. Please help! I feel really close to getting this to work, but also now it's been feeling that way for … -
Displaying Data in Django using HighCharts
I have text data in a example.txt file in the following format [[Date.UTC(1970, 10, 25), 0], [Date.UTC(1970, 11, 6), 0.25], [Date.UTC(1970, 11, 20), 1.41], [Date.UTC(1970, 11, 25), 1.64], [Date.UTC(1971, 0, 4), 1.6]] Which I am reading in django view.py file as follows filepath = os.getcwd() f = open(filepath+"/main/static/main/data/example.txt", "r") dataset = f.read() def home(request): context = {'dataset': dataset} return render(request, 'main/home.html', context) Loading it in the template as follows <script src="https://code.highcharts.com/highcharts.js"></script> <div id='dataset' data-dataset={{ dataset }} style="width:100%; height:500px;"></div> <script type="text/javascript" src="{% static 'main/js/main.js' %}" ></script> And javascript main.js file with highchart code as follows const app_control = (function() { var sdata; var init_charts; /* VARIABLES INITIALIZATIONS */ /* DEFINE THE FUNCTIONS */ /* Initialize Functions */ init_charts = function(sdata){ const chart = Highcharts.chart('container', { chart: { type: 'spline' }, title: { text: 'Example Data from ' }, xAxis: { type: "datetime", title: { text: 'Date' } }, yAxis: { title: { text: 'Data in Y Axis' } }, colors: ['#06C'], series: [{ name:'Visualized Data', data: sdata }] }) } /* PUBLIC INTERFACE */ public_interface = {}; /* RUN THE FUNCTIONS */ $(function(){ sdata = $('#TimeSeries').data('dataset'); init_charts(sdata); }); return public_interface; }()); The question is, why is the data not visualizing? If … -
last_updated date and time keeps updating everytime the user logs into the system but doesn't update any of their details in Django
In my model for user profile, the profile_last_updated = models.DateTimeField(auto_now=True) keeps updating every time the relevant profile owner logs in but doesn't update any of their details. Is there a way to fix this? I found this on SO django last updated keeps updating when there is no new information but it's a bit confusing. Appreciate any help - thanks! views.py def user_profile_detail_view(request,pk): try: myprofile = get_object_or_404(User, id=pk) except ObjectDoesNotExist: return redirect('handler404') -
Problem Generating Azure ADLS Gen2 SAS Token for Container with Python?
From azure.storage.blob I'm using the function generate_container_sas. I'm trying to generate a SAS token for a container in an ADLS Gen2 storage account in Azure. I can go into azure portal and generate a working SAS token using an account key with no issues. The token works just fine. However, when I do what I think is the same thing in python I get a token back but when I load it into storage explorer it says "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.". I have validated all the inputs appear to be correct. The token that is generated looks like: https://<STORAGE_ACCOUNT>.blob.core.windows.net/<CONTAINER_NAME>?se=2022-02-19T05%3A41%3A26Z&sp=rwdlac&sv=2020-10-02&sr=c&sig=jCd8AAatl5o9QsbMHtlca6oNnnRdKqtcOnWN3sZa1c8%3D sas_token = generate_container_sas( account_name=account_name, container_name=container_name, account_key=account_key, permission=AccountSasPermissions(read=True, list=True, write=True, delete=True, create=True, add=True), expiry=datetime.utcnow() + timedelta(hours=expiry_hours) ) -
Django messages multiple extra tags
I was trying to pass multiple extra tags in the messages.add_message() as a list. It seemed to work fine while using render, but when I'm trying to use redirect, it passes the extra_tags as a string and I can't get my objects by indexing as it considers the whole list as a string. Is there a way to solve this or pass multiple extra tags? Here is the code- def handleSignup(request): if request.method == 'POST': username = request.POST['signup_username'] name = request.POST['name'] password = request.POST['signup_password'] email = request.POST['email'] if User.objects.filter(username=username).exists(): messages.add_message(request, messages.INFO, 'Please try another username.', extra_tags=['danger', 'Username already taken!']) elif User.objects.filter(email=email).exists(): messages.add_message(request, messages.INFO, 'An account with the email already exists.', extra_tags=['danger', 'Email already in use!']) else: user = User.objects.create_user( username=username, email=email, password=password) user.name = name user.save() messages.add_message(request, messages.INFO, 'Account created.', extra_tags='success') else: return HttpResponse('404 - Not Found') return redirect('/') -
no module name 'django'(already installed django)
I get this error when I run "python3 manage.py runserver" from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' but I already installed and activated django in the virtual environment... I really don't know how to fix it because it worked well before -
Illegal instruction: 4 While running "python manage.py runserver"
Getting the error Illegal instruction and Python stopin macbook pro (os 12.2) -
I created a Django form that is working fine but when i try to update then it's not saving the data into database
When i post data through django model form it is working fine but when i update the data by using same form its not working. Please help me on this and also when i update form, every field is prefilled but not image field. It was working fine when i last updated few days back but it's not working now. I deleted migrations and database too but still not working. Waiting for your help, Thanks in advance. here is my code: views.py(for creation) def dashboard_employees_create(request): if not (request.user.is_authenticated and request.user.is_superuser and request.user.is_staff): return redirect('/') if request.method == 'POST': form = EmployeeCreateForm(request.POST,request.FILES) if form.is_valid(): instance = form.save(commit = False) user = request.POST.get('user') assigned_user = User.objects.get(id = user) instance.user = assigned_user instance.title = request.POST.get('title') instance.image = request.FILES.get('image') instance.firstname = request.POST.get('firstname') instance.lastname = request.POST.get('lastname') instance.reporting_to = request.POST.get('reporting_to') instance.startdate = request.POST.get('startdate') instance.employeetype = request.POST.get('employeetype') instance.employeeid = request.POST.get('employeeid') instance.dateissued = request.POST.get('dateissued') instance.save() messages.success(request,'Account Created Successfully!!',extra_tags = 'alert alert-warning alert-dismissible show') return redirect('dashboard:employees') else: messages.error(request,'Trying to create dublicate employees with a single user account ',extra_tags = 'alert alert-warning alert-dismissible show') return redirect('dashboard:employeecreate') dataset = dict() form = EmployeeCreateForm() dataset['form'] = form dataset['title'] = 'Register Employee' return render(request,'dashboard/employee_create.html',dataset) views.py for updation: (result is "Form Data not Valid") … -
metadata error showing when installing allauth
When iam trying to install authall package in django , its showing metadata-generation-failed.. Collecting django-allauth Using cached django-allauth-0.48.0.tar.gz (658 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [14 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\Svalia\AppData\Local\Temp\pip-install-tn0ujcx9\django-allauth_6b3b0a5ab58d495fa2ebbbd50cccbf59\setup.py", line 173, in setup(**METADATA) File "c:\users\svalia\desktop\yezwe-main\yezwe-main\venv\lib\site-packages\setuptools_init_.py", line 154, in setup install_setup_requires(attrs) File "c:\users\svalia\desktop\yezwe-main\yezwe-main\venv\lib\site-packages\setuptools_init.py", line 143, in install_setup_requires dist = MinimalDistribution(attrs) File "c:\users\svalia\desktop\yezwe-main\yezwe-main\venv\lib\site-packages\setuptools_init.py", line 135, in init super().init(filtered) File "c:\users\svalia\desktop\yezwe-main\yezwe-main\venv\lib\site-packages\setuptools\dist.py", line 456, in init for ep in metadata.entry_points(group='distutils.setup_keywords'): TypeError: entry_points() got an unexpected keyword argument 'group' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details. -
Next.js dynamic routes don't update when django database is updated
The frontent is Next.js, the backend is Django, and we're using the django admin to update information. The info updates just fine on static pages, but on dynamic routes it won't update. This is what the code looks like on the dynamic route pages on the getStaticPaths and getStaticProps in Next.js: export async function getStaticPaths() { const response = await fetch( `${process.env.NEXT_PUBLIC_BASE_CMS}/api/events/all`, ); let events; if (response.status === 200) { events = await response.json(); } const paths = events?.map((event) => ({ params: { id: `${event?.id}` }, })); return { paths, fallback: false, }; } export async function getStaticProps({ params }) { const response = await fetch( `${process.env.NEXT_PUBLIC_BASE_CMS}/api/events/one/${params.id}`, ); let event; if (response.status === 200) { event = await response.json(); } return { props: { event: event?.event || null }, revalidate: 10 }; } I thought adding the 'revalidate:10' would fix the issue, but so far it seems to be continuing, and in order for the changes to show up we have to redeploy every time changes are made to the backend, which isn't ideal. Any help would be appreciated, thank you! -
Django how to display foreign key in admin as list of links?
Say I have two Django models Room and User. I'll leave the models generic open here. At User I have a one-to-many-relationship with Room, so that one Room may be used by many users but its usage is optional: room = models.ForeignKey(Room, blank=True, null=True, on_delete=models.SET_NULL, related_name='users') How do I show at Room admin page a section with all its users? I already tried admin.TabularInline and it shows all the user fields as editable, but I'd like to have a list of link to users (e.g. user name) with the possibility to add an existing user to the list. I also tried adding the related_name users to the Room ModelAdmin list_display attribute, but nothing happend :D -
postgres column name ending with "_id" not possble?
I am using django and postgres for my app. I was trying to make a postgres table containing columns ending with "_id" to mimic relation table. Postgres made the column name the one without "_id". For example, class Math(models.Model): student_id = models.IntegerField() teacher_id = models.IntegerField() test_time = models.DateTimeField() test_id = models.CharField(max_length=255, unique=True) In postgres table, it turned out to be the column names of School table changed to; student teacher test_time test_id I guess postgres does not allow me to assign column name ending with "_id" at least for the IntegerField(). Is there any way to get around of this limitation? Thanks in advance. -
Django RTSP İp Camera to Browser
I want to publish ip Camera images on my web page, but I couldn't find a source.It works when I run it with the python cv2 library, but I haven't made any progress in my django project yet. Python code I found on the internet; import cv2 cap=cv2.VideoCapture('rtsp://admin:123456@192.168.1.216/H264?ch=1&subtype=0') while True: ret, frame = cap.read() cv2.imshow("Capturing",frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows() -
How to use django forms
currently when I run my app, am promoted to enter data from the terminal which i dont want eg Enter Loan Ammount from .forms import BasicForm def signup(request): if request.method == 'POST': form = BasicForm(request.POST) if form.is_valid(): # Entering the loan amount isCorrectAmount = True while isCorrectAmount: enteredLoanAmount = request.POST.get(float(input("Enter Loan amount (Min - 1,000,000): "))) if enteredLoanAmount < 1_000_000: print("Minimum Loan amount is 1,000,000") enteredLoanAmount = float(input("Enter Loan amount (Min - 1,000,000): ")) else: isCorrectAmount = False # Entering the age isCorrectAge = True while isCorrectAge: enteredAge = int(input("Enter Age (18 - 50 years): ")) if enteredAge < 18 or enteredAge > 50: print("Sorry, age does not meet criteria!") enteredAge = int(input("Enter Age (18 - 50 years):")) else: isCorrectAge = False # Entering the loan term isCorrectTerm = True while isCorrectTerm: enteredTerm = int(input("Enter Loan term (3 - 35 years): ")) if enteredTerm < 3 or enteredTerm > 35: print("Sorry, loan term does not meet criteria!") enteredTerm = int(input("Enter Loan term (3 - 35 years):")) else: isCorrectTerm = False # Entering the gender enteredGender = input("Enter Gender (MALE or FEMALE): ") I would like to stop this and enter data using my form not the terminal and my form …