Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django Add 2 Numbers and get Name and print it back in an html
I'm new to python and django What is the correct syntax to render number and text? I want to get the name and add 2 numbers from addition.html and print it back to results.html I tried this code def add(request): my_context = { "fname" : (request.GET['first_name']), val1 = int(request.GET['num1']), val2 : int(request.GET['num2']), res : val1 + val2 #return render(request, "result.html", {'result': res}) } return render(request, "result.html",my_context) -
how to send data using FCM without a notification message
I am using FCM for my app, which uses Django as the back end and the front end written by flutter. I can send notifications from my Django app in certain situations and it works as expected. All I need now is to send some data to the flutter app which will behave on it somehow, but without sending a message or notification to the user. here is how am sending notifications from my Django backend : from pyfcm import FCMNotification push_service = FCMNotification(api_key="****") def send_single_notification(deviceID,title,body): try: push_service = FCMNotification(api_key="****") registration_id = deviceID message_title = title message_body = body result = push_service.notify_single_device( registration_id=registration_id, message_title=message_title, message_body=message_body) except: print("failed to send notification") def send_multi_notification(list_of_ids,title,body): try: registration_ids = list_of_ids message_title =title message_body = body result = push_service.notify_multiple_devices(registration_ids=registration_ids, message_title=message_title, message_body=message_body) except: print("failed to send notification") just need to send only data .. -
How to render Nextjs pages using django-nextjs on Django
I'm getting ERR_TOO_MANY_REDIRECTS everytime that I'm trying to load http://localhost:8000/about/ despite localhost:8000 loading the next index page correctly. my next about page: function about() { return <h1>about</h1>; } export default about; Django Views from django.http import HttpResponse from django_nextjs.render import render_nextjs_page_sync def index(request): return render_nextjs_page_sync(request) def about(request): return render_nextjs_page_sync(request) Django urls from django.contrib import admin from django.urls import include, path from . import views urlpatterns = [ path('admin/', admin.site.urls), path("", include("django_nextjs.urls")), path("", views.index, name="index"), path("about/", views.about, name="about"), ] https://github.com/QueraTeam/django-nextjs have been following django-nextjs offical docs. Is there something that I'm missing? -
A function passed to Response(APIView) prints normally, but in response returns none
Made a function to generate a report about different models. Applied it on a specified url 'report/', need to make it write "Report "" generated" in a view, but it writes "none", but it prints normally what i need. views.py class Report(APIView): def get(self, request): ro = ADMReport() courses_report = ro.course_report(ro.course_qs) groups_report = ro.studentgroup_report(ro.studentgroup_qs) result1 = ro.report_generating(groups_report) print(result1) result2 = ro.report_generating(courses_report) print(result2) return Response({'Done: ': result1}) services.py class FileManager: @staticmethod def pd_to_excel(report_tuple): report, name = report_tuple pd_report = pd.DataFrame(report, index=list(report.values())[0].keys(), columns=report.keys()) pd_report.to_excel(f'{slugify(name)}_report.xlsx', sheet_name='Sheet1') return f'Report "{name}" generated' urls.py urlpatterns = [ path('', include(router.urls)), # 127.0.0.1/api/v1/courses, 127.0.0.1/api/v1/groups path('report/', Report.as_view(), name='report') Expecting passing returned result looking as "Report "%name%" generated" to APIView instead of "none". -
Is root urls.py means config/urls.py in Django?
I am super newbie on programming using django as a backend. I am making a login function with JWT (using simplejwt). Trying to make it while watching simplejwt official doc, I don't know what is root urls.py means in doc. In the first line of the above picture. "root urls.py" === config/urls.py ?? Am I right...? -
Django and whitenoise - caching "too much"
I am using Whitenoise to serve static files (images, css, js) for a Django site. Now my problem is that the static files seem to be "cached to much"(?) when working locally. Description of actions: Initially my static files are served correctly I edit a file in static/ I run ./manage.py collectstatic (which correctly identifies one updated file). When going to http://127.0.0.1:8000/ my browser consistently shows the old stale version of the file. I have even tried completely removing the generated staticfiles/ folder - and the browser still seems to be able to dig out an old version of the file? This is when running locally in debug mode. Do not have a consistent understanding of how it is in production, but I think it works better (as it should?) there. My configuration: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', .... INSTALLED_APPS = [ # My apps 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] ... ... STATIC_URL = 'static/' STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATIC_ROOT = BASE_DIR / 'staticfiles' STATICFILES_DIRS = [ ("js" , BASE_DIR / "static/js"), ("css" , BASE_DIR / "static/css"), ("img" , BASE_DIR / "static/img") ] I guess the problem is that I do not really understand the Whitenoise model … -
Django built-in login failed from react
django @method_decorator(csrf_exempt, name='dispatch') class UserLoginView(GenericAPIView): permission_classes = (AllowAny,) serializer_class = UserLoginSerializer def post(self, request): serializer = self.serializer_class(data=request.data) user = serializer.validate(request.data) if user is None: return Response(status=status.HTTP_400_BAD_REQUEST) else: user.before_last_login = user.last_login login(request, user) user.save() user = UserSerializer(user) return Response(data={'id': user.data['id'], 'img': user.data['image']} , status=status.HTTP_200_OK) react const res = await axios.post(`${APIURL}/account/login/`, { id: id, password: pwd, }); when I try to login from react, I get suceessful response( Response(data={'id': user.data['id'], 'img': user.data['image']}, status=status.HTTP_200_OK) ) but failes, still user is annonymousUser in django. How can I fix this error? -
Django. I can't understand the error of removing products from the catalog
I'm making a catalog, I can't understand why products are not displayed by catalog categories, it gives an error 404. The sections in the catalog work as they should. Here is the code: I am grateful in advance for any hint! models.py ` from django.db import models from django.urls import reverse class Catalog_text(models.Model): text_left = models.TextField('Text1') text_right = models.TextField('Text2') signature = models.CharField(max_length=255, verbose_name="Signature") class Meta: verbose_name = 'Text1' verbose_name_plural = 'Text2' class Catalog(models.Model): sections = models.CharField(max_length=150, db_index=True, verbose_name="Name") img = models.ImageField(upload_to='img/catalog/') slug = models.SlugField(max_length=150, db_index=True, unique=True, null=True) class Meta: ordering = ('sections',) index_together = (('id', 'slug'),) verbose_name = 'catalog' verbose_name_plural = 'catalogs' def __str__(self): return self.sections def get_absolute_url(self): return reverse('catalog', kwargs={"slug": self.slug}) class Category(models.Model): catalog = models.ForeignKey(Catalog, related_name='catalog', on_delete=models.CASCADE, verbose_name='Select a directory' ) name = models.CharField(max_length=150, db_index=True, verbose_name="Name") img = models.ImageField(upload_to='img/catalog/') slug = models.SlugField(max_length=200, db_index=True, unique=True, null=True) class Meta: ordering = ('name',) index_together = (('id', 'slug'),) verbose_name = 'Category' verbose_name_plural = 'Categories' def __str__(self): return self.name def get_absolute_url(self): return reverse('catalog-detail', kwargs={"slug": self.slug}) class Product(models.Model): category = models.ForeignKey(Category, related_name='category', on_delete=models.CASCADE, verbose_name='Select a category' ) name = models.CharField(max_length=255, db_index=True,unique=True, null=True, verbose_name="Название") text = models.TextField('Текст') url = models.CharField(max_length=255, db_index=True, verbose_name="Link to the website") pdf = models.FileField(upload_to='pdf/') slug = models.SlugField(max_length=200, db_index=True, unique=True, null=True) class … -
pass loop from view.py to html template in Django
I try to get the data in my models "Machines" and then need to get Additional information form other table related to each machine. I try bellow code in views.py and render it to specified html page. def allmachinesLOGO(request): machines=Machine.objects.all() c="" for m in machines: if m.tb_order_set.filter(status="2").exists(): c="2" else: c="0" context ={'machines':machines,'condition':c} return render(request,'pline/machineslogos.html',context) {% if condition == "2" %} <h4> working</h4> <img class="btn-circle" style="width: 15px" src="{% static 'images/icons/icons8-green-circle-48.png' %}" alt="image" /> {% else %} <h4>stop</h4> {{ condition }} <img class="btn-circle" style="width: 15px" src="{% static 'images/icons/icons8-red-circle-48.png' %}" alt="image" /> {% endif %} what's the correct way to pass loop from views.py to template in Django -
Image files were deleted by itself in AWS-S3
I'm using python Django framework for server and AWS-S3 for store uploaded image. Also, i'm using django-storages library for handle S3. But sometimes images were deleted by itself not through django server. Image urls were still exist in DB. So i changed create, put, delete, get action to get in bucket policy But still deleted by itself. django-storages setting in settings.py is this AWS_SECRET_ACCESS_KEY = S3['secret_key'] AWS_REGION = 'ap-northeast-2' AWS_STORAGE_BUCKET_NAME = 'loopusimage' AWS_S3_CUSTOM_DOMAIN = '%s.s3.%s.amazonaws.com' % ( AWS_STORAGE_BUCKET_NAME, AWS_REGION) AWS_DEFAULT_ACL = None DATA_UPLOAD_MAX_MEMORY_SIZE = 1024000000 FILE_UPLOAD_MAX_MEMORY_SIZE = 1024000000 DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage and changed bucket policy is this "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::loopusimage/*" } ] } What should i do to solve my problem? -
Django disable ForeignKey field in Form
I've been working on a project lately, and I want to disable fields based on different conditions. Now what I wanted to was disabling a models.ForeignKey. But this doesn't work, even though I tried many solutions from multiple forums. I tried this: self.fields["area"].widget.attrs["disabled"] = True``` I already used this in other projects and it worked totally fine. But the select in the Form is still clickable and you can change the choices. Also I tried disabling it in the Widgets directly, didn't work either. -
At the django-admin statics not lodaing /static/admin/css/base.css not found
urlpatterns = [some_urls] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) STATIC_URL = "/static/" STATIC_ROOT = os.path.join(BASE_DIR, "static/") STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), ] statics configured DEBUG = TRUE python manage.py collectstatic did 1000 times cache cleared I have no idea what to do, can anyone help me please -
Django SQL: related tables, use latest() on field of parent table
class OrderHeader(models.model): order_id = models.CharField(unique=True,max_length=100) last_modified = models.DateField() class OrderLine(models.model): line_nbr = models.IntegerField(unique=True) order = models.ForeignKey(OrderHeader,on_delete=models.Cascade) class RefundLine(models.model): line_nbr = models.IntegerField(unique=True) order = models.ForeignKey(OrderHeader,on_delete=models.Cascade) refund_type = models.IntegerField(default=1) How do I find the last_modified of RefundLine where refund_type = 1? I can not make head or tail of the django documentation. My guess RefundLine.objects.filter(refund_type=1).latest(order__last_modified) results in an error order__last_modified is not defined -
search/filter dropdown button just refreshes page when clicked? How do I fix this
I'm making a project that includes a button that when clicked, turns into a search bar with a dropdown of filtered results. When the button is clicked, the dropdown and search bar appear, but only for a split second, because the page refreshes and they disappear. How do I fix this? The button is inside of a form. Keep in mind this is a django project. Here is the form with the button included: <form method="post"> <div class="dropdown"> <button onclick="event.stopPropagation(); myFunction()" class="dropbtn">Dropdown</button> <div id="myDropdown" class="dropdown-content"> <input type="text" placeholder="Search Company..." id="myInput" onkeyup="filterFunction()" value="{{company}}"> {% for company in companies %} <a href="#">{{ company.name }}</a> {% endfor %} </div> </div> <input type="date" value="{{ date_applied }}"> {% csrf_token %} <p><input type="submit" value="Add application"></p> </form> Here is the javascript for the button: <script> function myFunction() { document.getElementById("myDropdown").classList.toggle("show"); } function filterFunction() { var input, filter, ul, li, a, i; input = document.getElementById("myInput"); filter = input.value.toUpperCase(); div = document.getElementById("myDropdown"); a = div.getElementsByTagName("a"); for (i = 0; i < a.length; i++) { txtValue = a[i].textContent || a[i].innerText; if (txtValue.toUpperCase().indexOf(filter) > -1) { a[i].style.display = ""; } else { a[i].style.display = "none"; } } } </script> I would really appreciate any guidance. -
Alternative to Heroku to run a non-commercial Django + Postgres app
I created a small volunteering project on Django using Postgres and deployed it to Heroku. From the 28th of Nov 2022, Heroku will remove all the free dynos. I'm not making money on the site, and I guess won't make (at least too much) - so I'm choosing a free alternative to Heroku. I found these services: https://heliohost.org/ https://www.qovery.com But they also didn't work for me. I'm pretty new to web development, so I'm looking for a relatively easy and free solution. There won't be too much traffic on the website. -
I want to implement SSO (Azure AD) on Django admin login but cant figure out how to do that
I'm required to implement SSO on the admin login in a django application. say xyz(dot)com/admin where xyz is my application. so instead of default login procedure I need it through azure ad sso. How should i implement this? I'm fairly new to django and couldent find relevent resources to do so. -
How can I update a OnetoOne related models instance in restframework?
I have two related model a user model and profile model. here's how the data looks like { "id": 2, "phone_number": 9843945748, "email": "someEmial@gmail.com", "profile": { "first_name": "Updated", "last_name": "Updated", "avatar": null, "date_of_birth": "1995-22-01" } } How do I override update() method in serializer to just updated the profile fields. bypassing the USER MODEL required field which is email, phone_number. -
Django and Xcode exception when running website locally
I have a functioning Django site, but when I run the website locally, I get the following exception error. It doesn't appear to occur on the hosted site. Nothing I can find is not working, it is just a puzzle to me why this error is coming up and I would like to fix it because it is annoying - but I don't know where to start looking. Is there a common XCode Django connection that I am overlooking? ---------------------------------------- Exception occurred during processing of request from ('127.0.0.1', 56089) Traceback (most recent call last): File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socketserver.py", line 683, in process_request_thread self.finish_request(request, client_address) File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socketserver.py", line 747, in __init__ self.handle() File "/Users/u1123114/Documents/projects/kinbank_website/website/myvenv/lib/python3.9/site-packages/django/core/servers/basehttp.py", line 171, in handle self.handle_one_request() File "/Users/u1123114/Documents/projects/kinbank_website/website/myvenv/lib/python3.9/site-packages/django/core/servers/basehttp.py", line 179, in handle_one_request self.raw_requestline = self.rfile.readline(65537) File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socket.py", line 704, in readinto return self._sock.recv_into(b) ConnectionResetError: [Errno 54] Connection reset by peer ---------------------------------------- -
Image files were deleted by itself in AWS S3 bucket [closed]
I'm using python Django framework for server and AWS-S3 for store uploaded image. Also, i'm using django-storages library for handle S3. But sometimes images were deleted by itself not through django server. Image urls were still exist in DB. So i changed create, put, delete, get action to get in bucket policy But still deleted by itself. What should i do to solve my problem? -
Django Rest Framework settings to allow Authentication from Flutter using Authroization key
I am currently trying to fetch data using Flutter from Django rest framework with the following: final response = await http.get( url, headers: { HttpHeaders.authorizationHeader: 'Authorization: Bearer ......bla bla ..........', }, ); but I keep getting {detail: Authentication credentials were not provided.} and from the Django Rest Framework terminal it is showing: Forbidden: /api/dj-rest-auth/user/ Here is the Django settings.py: INSTALLED_APPS = [ ....................... 'rest_framework', 'users', 'corsheaders', 'django.contrib.sites', 'rest_framework.authtoken', 'dj_rest_auth', 'allauth', 'allauth.account', 'allauth.socialaccount', 'dj_rest_auth.registration', ] # REST_FRAMEWORK = { # 'DEFAULT_PERMISSION_CLASSES': [ # 'rest_framework.permissions.AllowAny', # # ]} REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.TokenAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ) } CORS_ALLOW_ALL_ORIGINS=True AllowAny =True When I tried to use 'rest_framework.permissions.AllowAny' it returned forbidden when used 'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication',), 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',) returned Unauthorized here is the views.py: @csrf_exempt def aPage(request): user:User=User.objects.get(pk=1) username=request.POST.get("username") email=request.POST.get("email") print(email) print(username) return JsonResponse({"Username":username , "email": email}) How can I send authenticate a logged in user using their Token to allow them to get data from api? What am I doing wrong that is returned these errors? -
Django ORM How to query and get values when multiple conditions are fulfilled
I have following model class TimePeriod(BaseModel): product = models.ForeignKey(to=Product, on_delete=models.CASCADE) min_travel_days = models.PositiveIntegerField() max_travel_days = models.PositiveIntegerField() value = models.DecimalField(max_digits=19, decimal_places=10) is_business = models.BooleanField() insurance_period_min_days = models.PositiveIntegerField( null=True, blank=True) insurance_period_max_days = models.PositiveIntegerField( null=True, blank=True) and Product model is as class Product(BaseModel): name = models.CharField(max_length=255) I have the following sheet to calculate the min_days and max_days and insurance min max days. Insurance_period Travel days Value 1-92 days 1-30 days 30 1-183 days 1-90 days 45 1-365 days 1-90 days 50 1-365 days 1-180 days 60 My problem is suppose I have 29 days as travel days and 90 days as Insurance days How do I calculate the value by using django query? As the actual value for 90 days of insurance days and 29 days travel time is 30. I tried doing this way TimePeriod.objects.filter(is_business=True,product__name='silver',insurance_period_min_days__lte=90,insurance_period_max_days__gte=90, min_travel_days__lte=29,max_travel_days__gte=29).values('value').first() I am getting 4 different result as my query satisfies all condition of above table any way I can do to satisfy above table conditon? to get 30 as value? -
Is there a way to install Django Rest Application as a single installable file [.exe]?
Looking for a encrypted way of installation for Django rest application. Is there a way to install it as binary or encrypted format or as a class files like Java. Currently source code is being copied into server path and executing below command python manage.py runserver I was trying to do with below package pyconcrete - Unable to install using pip command. pyinstaller - Only migration folder and files are copying to dist folder not the other files in each module. pyinstaller --name=application-name application-name/manage.py ./dist/application-name/application-name.exe runserver localhost:8000 --noreload -
django channels on railway no supported websockets library detected
I'm migrating my portfolio projects from heroku to railway, they're all asgi and use django channels and redis. They work fine on heroku, but not on railway. All of my api endpoints are working and connecting to postgres. But when I got to the chat part of my application it won't connect. The deploy logs in railway say the following: [2022-11-11 02:19:58 +0000] [11] [WARNING] Unsupported upgrade request. [2022-11-11 02:19:58 +0000] [11] [WARNING] No supported WebSocket library detected. Please use 'pip install uvicorn[standard]', or install 'websockets' or 'wsproto' manually. I've double checked my requirements.txt and updated my packages. I've uninstalled and reinstalled locally ( I made sure to use uvicorn[standard] which supports sockets). I've used railway cli to manually pip install install the packages and none of the above has worked. I'm not using any heroku buildpacks. Any body else having this issue? -
ModuleNotFoundError while running '$ python manage.py collectstatic --noinput'
I tried to solve this problem by searching a lot but couldn't find any solutions. I am trying to deploy my django app to heroku from heroku-CLI but got this error while running '$ python manage.py collectstatic --noinput'. ModuleNotFoundError: No module named 'my_app.settings.local'; 'quiz_api.settings' is not a package !Error while running '$ python manage.py collectstatic --noinput'. This error happened after settings.py is divided into base.py, local.py and product.py. Before this, there was no problem at all. root my_project -my_app -settings __init___.py "in settings dir" base.py local.py production.py __init__.py "in my_app dir" wsgi.py etc... .env manage.py etc... base.py (BASE_DIR might be the problem) from pathlib import Path import os import json BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'cloudinary_storage', 'cloudinary', 'my_app', 'rest_framework', 'django_filters', 'debug_toolbar', 'django_cleanup.apps.CleanupConfig', 'djoser', 'corsheaders' ] REST_FRAMEWORK = { 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'], 'DATETIME_FORMAT': "%Y-%m-%d %H:%M", 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'PAGE_SIZE':8, } MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware', ] STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' INTERNAL_IPS = ['127.0.0.1'] ROOT_URLCONF = 'quiz_api.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'quiz_api.wsgi.application' CORS_ALLOW_CREDENTIALS = True import dj_database_url MAX_CONN_AGE = 600 … -
I am not able to delete a specific item from a table in Django template/view
I have a list of wallet addresses in my template. When I tried deleting an address by clicking on the delete button, it returns an error message. I think it is an error from the way my template was structured. But, I don't really know. When I try deleting an address by manually inputting the id of the address in the delete view URL, it gets deleted. Here is the error message that is returned. Traceback (most recent call last): File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\fields\__init__.py", line 2018, in get_prep_value return int(value) The above exception (invalid literal for int() with base 10: 'Btc') was the direct cause of the following exception: File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\contrib\auth\decorators.py", line 23, in _wrapped_view return view_func(request, *args, **kwargs) File "C:\Users\admin\Documents\Django\crypto\dashboard\views.py", line 275, in del_wallet wallet.delete() File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\base.py", line 1137, in delete return collector.delete() File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\deletion.py", line 475, in delete query.update_batch( File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\sql\subqueries.py", line 78, in update_batch self.get_compiler(using).execute_sql(NO_RESULTS) File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\sql\compiler.py", line 1819, in execute_sql cursor = super().execute_sql(result_type) File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\sql\compiler.py", line 1382, in execute_sql sql, params = self.as_sql() File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\sql\compiler.py", line 1785, in as_sql val = field.get_db_prep_save(val, connection=self.connection) File "C:\Users\admin\Documents\Django\env\lib\site-packages\django\db\models\fields\related.py", line 1146, in …