Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Creating an annual income field in django models with currency option of all types available in djmoney
I have created annual_income field in django-model like this : annual_income = MoneyField( max_digits=10, decimal_places=2, null=True, default_currency="INR" ) here the default currency has been set to INR. I would like to have the field in such a way that it takes the currency as input, instead of setting it to default 'INR'. In the admin page, this field should be displayed such that there is dropdown option for the currencies -
How can I add a css class to elements conditionally in django?
I have created a template of sidebar in django which is extended by various pages. <ul class="navbar-nav flex-column mt-5"> <li class="nav-item"> <a class="nav-link p-3 mb-2 text-white" href=#> <i class="fas fa-home text-white ml-2 fa-lg mr-3"></i> Dashboard </a> </li> </ul> <ul class="navbar-nav flex-column"> <li class="nav-item"> <a class="nav-link p-3 mb-2 text-white" href="{% url 'a' %}"> <i class="fas fa-briefcase text-white ml-2 fa-lg mr-3"></i> Business </a> </li> </ul> <ul class="navbar-nav flex-column"> <li class="nav-item"> <a class="nav-link p-3 mb-2 text-white" href="#"> <i class="fas fa-chart-pie text-white ml-2 fa-lg mr-3"></i> Analytics </a> </li> </ul> The links shown above direct to various pages and are present in sidebar i.e the template. I have created two css classes current and sidebar-link to show which link from the above is active and which are sidebar links. How do I conditionally apply one of these classes to these links depending upon which one is currently active? -
"module not found" when running Celery with supervisor
I'm trying to run celery with django using supervisor. supervisor_celery.conf [program:supervisor-celery] command=/home/user/project/virtualenvironment/bin/celery worker -A project --loglevel=INFO directory=/home/user/project/project user=nobody numprocs=1 stdout_logfile=/home/user/project/logs/celery.log stderr_logfile=/home/user/project/logs/celery.log autostart=true autorestart=true startsecs=10 stopwaitsecs = 600 stopasgroup=true priority=1000 on runing supervisor , i got following error in logs file:- Unable to load celery application. The module project was not found. project structure is project |-project |-settings |-production.py |-__init__.py |-celery.py |-urls.py |-wsgi.py |-app The contents of __init__.py is:- from __future__ import absolute_import, unicode_literals from .celery import app as celery_app __all__ = ('celery_app',) The content of celery.py is from __future__ import absolute_import, unicode_literals import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings.production') app = Celery('project') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() It would be helpful if anyone can tell me why it's not working? -
Handle simple requests asynchronously using Django REST or with another method?
Firstly, sorry if the question is so obviously (I'm quite newbie). I have a Django project where the user can add or remove, for example, interests to his/her profile (ManyToMany relationship). I've achieve this with 3 views. The first one where the profile's interests are rendered, the second one to add (nothing is rendered, when the user click a link, the view just update the profile and return the first view, the one with the profile's interests) and the third one to remove interest. urls.py path('home/overview/add/<int:interest_pk>', add_view, name="add_view"), views.py def add_view(request,interest_pk): #the third (the one to remove) view is similar user = request.user user.profile.interests.add(Category.objects.filter(pk= category_pk).get()) return redirect('overview') #Overview is the view where the interests are rendered This works but now I'd like to improve this making it asynchronously. So here is my question, should I use Django Rest Framework to handle this kind of request (the ones related to the POST and DELETE methods) or is there any other method? Note: I'm not using forms to send the information (I'd rather not to use it because it's simpler to send in an url the pk of the interest and handle it in a view) and I think it could be … -
Django allauth messages piling on on login screen
I'm using Django Allauth and after a user goes through the steps, confirms and signs in, if they log out and go to the login screen, they see a bunch of old messages. The design of my site doesn't have messages displayed on every screen, so they're piling up and showing all at once. How do I clear these before the user sees the whole pile? -
Adding StreamField call-to-actions to base.html using Wagtail CMS
Hi I'm new to using Wagtail and I'm working on a client website. What I aim to do is to dynamically link my wagtail pages to our sidebar, which is currently in our base.html in the main app folder's templates directory, the one with settings.py. I was wondering if there's a way to render a call to action for the base.html here. Or if I should make a separate app instead and create a base.html there, which extends to all the other templates I'll use for the rest of the website. Thank you! -
Django deployment in Hostgator VPS
I'm trying to run django using mod_wsgi module in easyapache4 on CentOS 7 VPS provided by Hostgator. I'm new to this. I've no experience in deploying Django apps on live servers but I've deployed in our office local network in an Ubuntu server machine. I've this responsibility to deploy Django apps on Hostgator VPS which we already had for sometime for deploying PHP based Wordpress, Magento websites and am not looking to invest some money for any other provider since we already have a VPS. Our Hostgator Reseller VPS account has CentOS 7, easyapache 4 and I've installed mod_wsgi successfully which was not pre-installed. Case 1: PHP and Django on same domain We usually run our client projects in our domain like www.ourdomain.com/php/php_project_one/. To run django on the same domain in a differrent path to day like www.ourdomain.com/python/python_project_one/ how should the virtual host configuration be ? I know that whenever i register a new server space account through WHM a virtual host configuration is added to apache config file for that particular domain. So, should i be editing that virtual host configuration to create this said Case 1 ? What I tried is, adding additional configuration at the end of … -
Javascript to detect "waiting for locahost" when the form is submitted
When i submit a form below, it shows "waiting for localhost" till the response is received from the django view. How do i detect that event for ("waiting for locahost ") in javascript. (Note: I dont want to send a AJAX request, just a form submit with "POST" method) Please help. <form class="navbar-form" role="search" action ="{%url 'search:search'%}" method="POST"> {% csrf_token %} <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="v_id" autocomplete="off"> <div class="input-group-btn"> <button class="btn btn-success" type="submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> -
Is knox token is safe are not?
I'm using Drf(django rest framework) for my back end development. I tried to use Knox-token for authentication and token generation. I new to this knox-token. I need to know is Knox token is safe are not?. I'm going to develop web based product. So the product must be safe with full secure. Can i use knox-token for my product? -
How to disable Enforce HTTPS for localhost auth testing?
I tried to configure social authentication via Facebook in my Django project. As I am testing at localhost (already included the http-based site in ALLOWED_HOSTS) , I need to disable Enforce HTTPS. My fb app is now in development mode, but by default Enforce HTTPS is enabled and couldn't be changed apparently. How can I fix it? Thanks! -
Using Browser Router in react-router-dom with Django backend
I'm building an application that uses React as front-end and Django Rest as back-end. From front-end, I'm using react-router-dom for declarative routing and Django only serves API So when user enters an URL like this https://myapp.com/something/something-else, it's actually handle by Django and it will return an error since Django doesn't know which page to lead to with this URL. It should be handled by React instead. One of the workaround I have is to use a Hash Router, so the URL will look like this (with the hash symbol): https://myapp.com/#/something/something-else But there have been cases where user will just key the URL without the hash sign (as they didn't know). Is there away to handle this without using Hash Router? -
File "manage.py", line 16 ) from exc ^ SyntaxError: invalid syntax
I will develop the web using Django, but when I try to runserver, it gives: File "manage.py", line 16 ) from exc ^ SyntaxError: invalid syntax This is the code for manage.py - #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'firstsite.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main() I am using django 3.0.5 and python python 3.8.2 how to solve ? -
Mudar o estilo de um formulário do Django
Olá, estou fazendo uma página de edição da conta do usuário, porém quando fui fazer o formulário usando o django não consegui mudar o style dela. Como posso fazer o formulário do django ficar dessa forma? Tentei fazendo da forma tradicional porém nada. https://i.imgur.com/P09UMkT.png views.py @login_required def edit(request): form = EditAccountForm() context = {} context["form"] = form return render(request, "accounts/edit.html", context) form.py class EditAccountForm(forms.ModelForm): def clean_email(self): email = self.cleaned_data["email"] if User.objects.filter(email=email).exclude(pk=self.instance.pk).exists(): raise forms.ValidationError("Conta já existente com esse email!") return email class Meta: model = User fields = ["username", "email"] edit.html <body data-spy="scroll" data-target=".navbar" data-offset="50"> <div class="container py-2 mt-5"> <div class="row my-2"> <div class="col-lg-4"> <h2 class="text-center font-weight-light">User Profile</h2> </div> <div class="col-lg-8"> </div> <div class="col-lg-8 order-lg-1 personal-info"> <form role="form" method="post"> <div class="form-group row"> <label class="col-lg-3 col-form-label form-control-label">Nickname</label> <div class="col-lg-9"> <input class="form-control" type="text" value="Teste" /> </div> </div> <div class="form-group row"> <label class="col-lg-3 col-form-label form-control-label">Email</label> <div class="col-lg-9"> <input class="form-control" type="email" value="teste@gmail.com" /> </div> </div> <div class="form-group row"> <label class="col-lg-3 col-form-label form-control-label">Password</label> <div class="col-lg-9"> <input class="form-control" type="password" value="11111122333" /> </div> </div> <div class="form-group row"> <label class="col-lg-3 col-form-label form-control-label">Confirm password</label> <div class="col-lg-9"> <input class="form-control" type="password" value="11111122333" /> </div> </div> <div class="form-group row"> <div class="col-lg-9 ml-auto text-right"> <a href="/"><input type="reset" class="btn btn-outline-secondary" value="Cancel" /></a> <a href="{% url … -
Django login 'NoneType' object has no attribute 'append'
Having an issue with Django Allauth. When I log out of one user, and log back in with another, I get this issue, both locally and in production. I'm using the latest version of Allauth, Django 3.0.5, and Python 3.7.4. It seems like this is an Allauth issue, but I haven't seen it reported online anywhere else. So just wondering what I can do next to troubleshoot. Login works fine, less I just logged out of another user. 'NoneType' object has no attribute 'append' Request Method: POST Request URL: http://127.0.0.1:8000/account/login/ Django Version: 3.0.5 Exception Type: AttributeError Exception Value: 'NoneType' object has no attribute 'append' Exception Location: /Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/allauth/account/adapter.py in authentication_failed, line 507 Python Executable: /Users/[USERDIR]/Sites/frontline/venv/bin/python Python Version: 3.7.4 Python Path: ['/Users/[USERDIR]/Sites/frontline', '/Users/[USERDIR]/Sites/frontline/venv/lib/python37.zip', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/odf', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/odf', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/odf', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/odf', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/odf', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/odf', '/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/odf'] Server time: Thu, 16 Apr 2020 17:53:52 -0700 Environment: Request Method: POST Request URL: http://127.0.0.1:8000/account/login/ Django Version: 3.0.5 Python Version: 3.7.4 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.sites', 'django.contrib.sitemaps', 'django.contrib.postgres', 'common', 'bootstrap4', 's3direct', 'bootstrap_datepicker_plus', 'import_export', 'tinymce', 'allauth', 'allauth.account', 'allauth.socialaccount', 'debug_toolbar', 'dashboard', 'marketing'] Installed Middleware: ('debug_toolbar.middleware.DebugToolbarMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware') Traceback (most recent call last): File "/Users/[USERDIR]/Sites/frontline/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = … -
Django not receiving data from ajax
I've been trying to work and understand ajax without relying on jquery for learning purposes. I'm sending data I got from a textfield. Here's my ajax document.addEventListener('DOMContentLoaded', function() { document.getElementById('id_tags').onkeyup = () => { // initialize new request const request = new XMLHttpRequest(); request.open("POST", "{% url 'tag_suggestions' %}"); var keyword = document.getElementById('id_tags').value; data = {"keyword": keyword}; //when request is finished request.onload = () => { console.log("Test"); } //send request request.setRequestHeader("X-CSRFToken", '{{csrf_token}}'); request.send(JSON.stringify(data)); }; }); Here's the django function that listens on my ajax requests def tag_suggestions(request): print('inside tag_suggestions ') if request.method == 'POST': print(request.POST.keys()) return ('Test') else: print('not ajax Test') return HttpResponse('Test') I've tested my javascript code it's just fine. It listens on events, got the value properly. But in my django, when it executes request.POST.keys(), the output will be dict_keys([]) and I concluded that I'm not receiving the data from my ajax request. -
Best solution to create live status/control web dashboard for running web scraper?
I have a few python web scrapers built using Selenium and Python. I'd really like to build a web-based front end for these that will show live (ie. without having to refresh the page) status updates from each of the 3 scrapers simultaneously, and allow control of them remotely (eg. starting/stopping, changing search terms/options, and exporting data as a downloadable csv). I've looked at the current python web dashboard solutions, all of which seem to fall short in some way or other - they're more aimed at data visualisation/graphing, don't update live etc. This leaves rolling my own: My current thinking is to use Django with the Channels package (to enable live updates), which feels like overkill and an overly complex solution, so I thought I'd ask here in case anyone knew of anything more suitable? If I did have to go with Django, since each of the 3 scrapers is currently a separately running Python script, how would I ultimately tie them all together so that they'd all be controlled by the web interface? Run them as separate threads within the central Django script perhaps? Many thanks for any insights you can offer! Rufus -
Customizing output file name
with open('media_cdn/account/pdf01.pdf', 'wb') as out_file: output.write(out_file) How can I format this to have a custom name for each output? For example, I have tried: author_id=str(instance.author.id) with open('media_cdn/account/{author_id}-pdf01.pdf', 'wb') as out_file: output.write(out_file) however, the file is output as "{author_id}-pdf01.pdf" -
Django-import-export always exports same file despite the changes in the resource
Hello I'm new to Django framework and got stuck with the below issue while using django-import-export in django admin panel. I have a relationship between two models via a Foreign Key and I would like to export an attribute instead of the "id" of the related item. I have tried the ForeignKeyWidget did not work. I have also tried to get the deserved attribute via defining fields and using underscore like "custodian__name" and no luck. Then I discover actually I cannot alter anything in the exported file(not even selecting which fields to export etc.) I have always saved my work and even tried to restart the server after each change, still no luck. No errors, I just keep exporting the same exact file which is the export of all the fields in the database. I cannot find what I'm doing wrong. Hope someone can help # admin.py from django.contrib import admin from import_export import resources, fields from import_export.widgets import ForeignKeyWidget from import_export.admin import ImportExportModelAdmin from .models import Custodian, Asset class AssetResource(resources.ModelResource): custodian = fields.Field(column_name = 'custodian', attribute = 'custodian', widget = ForeignKeyWidget(Custodian, 'name')) class Meta: model = Asset fields =['tag_number', 'description', 'custodian',] class AssetAdmin(ImportExportModelAdmin, ExportMixin): resources_class = AssetResource admin.site.register(Asset, AssetAdmin) … -
How to organise unit-test for the javascript files in a django project so they can be run from CLI and be integrated to Gitlab-CI script?
I have made my project alone and as a hobby and looking for the professionnal methodology to do it: I have got my django project oganised in a standard way: Myproject +-- App1 │ +-- migrations │ +-- static │ │ \-- js │ +-- apps.py │ +-- __init__.py │ +-- migrations │ +-- static │ │ \-- js │ │ +-- App1.js # <-- javascipt for my first app │ +-- templates │ │ +-- App1.html │ +-- tests # <-- contains python tests for my first app │ │ \-- test_views_App1.py │ +-- tests.py │ +-- urls.py │ \-- views.py +-- App2 ... │ │ \-- js │ │ +-- App2.js # <-- javascipt for my second app ... │ +-- tests # <-- contains python tests for my second app │ │ \-- test_views_App2.py │ +-- urls.py │ \-- views.py +-- App3 ... +-- pytest.ini +-- manage.py For each of my app, I often have Javasript scipt for my frontend. I have used JQuery to build them so naturaly, I am thinking of using Qunit for my unit-test. The django documentation is quite succint about that subject. So I wonder what is the best practise for organising … -
Can we upload google sheets api credentials on github?
I have made a web application that uses Google Sheets as a database. I want to upload my project on github. But since it uses google sheets API for fetching data, I was wondering if is it safe to upload because I will also have to upload API credentials as well? I have seen a lot of questions like this on Stack Overflow but none of them addressed this question clearly. Also, my application/database is nothing confidential or anything like that. My only concern is if uploading API credentials can cause any harm to my google account? -
Django Rest Framework: In App purchase for Apple App store and Google Playstore
We're developing a mobile app. Users will be able to subscribe to our monthly services. We're using flutter and django. We had configured our payments to use stripe. But we've just learned that stripe is not compatible with the online stores for in app purchases. I am the django developer but I've never had to deal with integrating mobile apps. Is there a documentation/ package / integration method for django to use in app purchases? -
Cannot run migrate
I am referring to my privious question, which was not answered. Cannot run migrate while using an existing database I tried by myself all the methods I could find but all of them didnot work. Please take a look to my question. Thanks for the help. -
Django display error messages for default login backend
I am using Django's default authentication backend, and I cannot get the messages framework to work with it to show error messages (such as incorrect username, invalid password etc). Everything that I have searched through here to suggest to make a custom authentication backend, but is there any easier way to do it? I already have a form which is subclassing the AuthenticationForm to use form_valid method, is there anything I could do there? Any help would be really appreciated. -
ModuleNotFoundError at /api/social/convert-token No module named 'path.to'
Hi Im trying to Authenticate Users on an foodtasker project using POSTMAN, but I have an error, could anyone help me please. Error is the following: ModuleNotFoundError at /api/social/convert-token No module named 'path.to' Traceback: File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/django/views/decorators/csrf.py" in wrapped_view 54. return view_func(*args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/django/views/generic/base.py" in view 71. return self.dispatch(request, *args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapper 45. return bound_method(*args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/django/views/decorators/csrf.py" in wrapped_view 54. return view_func(*args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/braces/views/_forms.py" in dispatch 30. return super(CsrfExemptMixin, self).dispatch(*args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/rest_framework/views.py" in dispatch 505. response = self.handle_exception(exc) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/rest_framework/views.py" in handle_exception 465. self.raise_uncaught_exception(exc) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/rest_framework/views.py" in raise_uncaught_exception 476. raise exc File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/rest_framework/views.py" in dispatch 502. response = handler(request, *args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/rest_framework_social_oauth2/views.py" in post 70. url, headers, body, status = self.create_token_response(request._request) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/oauth2_provider/views/mixins.py" in create_token_response 124. return core.create_token_response(request) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/oauth2_provider/oauth2_backends.py" in create_token_response 149. headers, extra_credentials) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/endpoints/base.py" in wrapper 116. return f(endpoint, uri, *args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/rest_framework_social_oauth2/oauth2_endpoints.py" in create_token_response 60. request, self.default_token_type) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py" in create_token_response 60. self.validate_token_request(request) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/rest_framework_social_oauth2/oauth2_grants.py" in validate_token_request 91. user = backend.do_auth(access_token=request.token) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/social_core/backends/facebook.py" in do_auth 153. return self.strategy.authenticate(*args, **kwargs) File "/Users/cfvs/Desktop/myvirtualenv/foodtasker/lib/python3.7/site-packages/social_django/strategy.py" … -
mock.patch() Not patching function in module call, but is in test function
So I am trying to mock a function and it is not being mocked in the module where it is being called, but it when called directly in the test function. I am unsure what I'm doing wrong. I use patch all the time without any problems. So in the test I have below from unittest.mock import patch from django.test import TestCase from web.utils.registration import test_render_mock class TestRenderMock(TestCase): @patch("django.shortcuts.render") def test_render_mock(self, render_mock): request = self.make_request() # Calls render in same way in function below test_render_mock(request) from django.shortcuts import render r = render(request, 'c') print(type(r)) which is calling the function in the file web/utils/registration.py from django.shortcuts import render def test_render_mock(request): r = render(request, 'registration/signup_link_error.html') print(type(r)) And it isn't mocking the render call in the function test_render_mock but it is in the test function test_render_mock(). The console output is below. <class 'django.http.response.HttpResponse'> <class 'unittest.mock.MagicMock'> I have no idea what I'm doing wrong. Any help would be appreciated. Using python version 3.8.2 and Django 3.0.5