All Questions

Tagged with
Filter by
Sorted by
Tagged with
1vote
1answer
37views

How to pass tuple with one element as param in sql query Python?

How can I pass tuple with only one element as param in sql query Python? I have tried this solution suggested here: imploding a list for use in a python MySQLDB IN clause ids = [(UUID('1232a4df-5849-...
user avatar
  • 545
0votes
1answer
10views

Creating a custom User model by extending AbstractBaseUser

I am trying to create a custom User(CustomUser) by extending AbstractBaseUser. I am trying to remove username field and use email for authentication.I have not done the first migration yet. Here is ...
user avatar
0votes
0answers
12views

Django multiple user login on multiple tab session issue

I have an issue with my Django app. If I use to login to the app with different users from different browser tab , then it is loging out the first user. I am using django file bases session, which ...
user avatar
  • 173
0votes
0answers
22views

How to Register a user either by Email ID or by Mobile Number in Django? [closed]

I can register a user getting both email address and mobile number in my application. But what I really want is to register a user using either email or mobile number. So that if a user provides email ...
user avatar
0votes
0answers
15views

Remove library root on venv

I created a project in django ear the venv folder The words library root appear why is it happening? How do I remove / cancel it? I want it to look like this without library root just venv Screenshot ...
user avatar
1vote
2answers
44views

How to display the keys of a python dictionary as HTML table headers and values of each key as a row under that table header?

I'm currently working in a django project in which I do some data analysis using pandas library and want to display the data (which is converted into a dictionary) as a HTML table. dictionary that I ...
user avatar
0votes
0answers
9views

How to allow REST filters for non-DB fields in django

My problem is this: I'm working on a django project that has a lot of DB tables representing many different objects. This project has a GUI interface that is mostly a table that is a rough ...
user avatar
1vote
0answers
22views

Django: Is a user without a password safe?

I'm trying to create an interactive website with Django for a chat bot. I have a model that stores the chat logs, ChatLogs. It has two fields: sender and message. sender, as the name might suggest, ...
user avatar
  • 105
1vote
1answer
10views

How to implement Django social login using google for different type of users(eg: candidate ,employer, customer)

I want to implement Social login in my Django project. When I searched about it, I found social login for only one user. But I want to implement it for different type of users as I mentioned in the ...
user avatar
1vote
1answer
42views

How to handle 50k or above array of objects in Django Rest Framework?

I'm facing a problem. Our requirement is we cannot use pagination so we need all records at a time in Response. my function like this: from rest_framework.response import Response class ...
user avatar
  • 1,000
0votes
1answer
23views

Manager isn't accessible via Police instances

Error is occurred in if user.objects.filter(login_id=login_obj).exists(): how to solve this error This is my police_app/views.py def police_register(request): if request.method == 'POST': ...
user avatar
0votes
1answer
21views

How do I retrieve data from a Django DB before sending off Celery task to remote worker?

I have a celery shared_task that is scheduled to run at certain intervals. Every time this task is run, it needs to first retrieve data from the Django DB in order to complete the calculation. This ...
user avatar
0votes
1answer
17views

SQLAlchemy - Passing a DDL generated Primary Key to Child Model through Relationship

I currently have a parent/child relationship defined between the Invoice/Item table. When running the following code: with Session(engine) as session: invoice = Invoice(INV_STORE=99, items=[Item(...
user avatar
1vote
1answer
10views

what is fields and field_classes in django UserCreationForm?

im new to learning django and i wanted to make signup form in django but i see this part of code and i didnt understand it what are these code doing and why we use them class UserCreationForm(forms....
user avatar
  • 11
-2votes
0answers
8views

Make django application healthy on AWS instance

I am a beginner and I want to know how to find loose entry points in the pre existed application that can help to make aws server healthy.
user avatar
0votes
1answer
14views

Get and use the value from foreign key field without any conversions (Django)

I tried to get the value from the foreign key field "tax" in "priceWithTax()", then finally, I could get the value with this code below: taxObject = self.tax This is the full code:...
user avatar
0votes
0answers
19views

Data don't automatically updated that I uploaded from django admin

In development , I uploaded some data from django admin to a table. But when I refresh a page that uses that table then the new added data don't appears . It appears only when i rerun the manage.py ...
user avatar
0votes
0answers
13views

I try to add a picture of favicon.ico in Django project

How to add favicon.ico image in django project.
user avatar
-3votes
0answers
26views

Scanning External files inside python backend [duplicate]

I have some files that I need to download and then upload to a specific location during execution of code. These files are other than source code files but required by the source code(.yaml, .xml, ...
user avatar
0votes
0answers
15views

API request failing if pagination is required in Django due to OrderBy' object has no attribute 'lstrip'?

I have a view that inherits from the ListModelMixin from Django REST Framework and have overridden the list(...) function so I can add query parameter validation to the list method: <!-- language: ...
user avatar
  • 143
0votes
0answers
32views

ValidationError at /opd/ ['“OPDCashSheet object (2)” value must be a decimal number.'] How can a model-object be a decimal number?

models.py: class Opd(models.Model): patient=models.ForeignKey(Patient, on_delete=CASCADE) bill_number=models.IntegerField(default=None) date=models.DateField(default=datetime.date.today) ...
user avatar
  • 67
0votes
0answers
15views

Steam API json output isn't being displayed cleanly

I've been trying to get the output from the steam API to display in my django app. My goal is to create a "portfolio" of games that I own for a project - using the information in the Steam ...
user avatar
0votes
2answers
25views

Field is required in the Django Admin even though I have set "blank=True" in the Model

In models.py class DeploymentType(models.Model): deployment_type = models.CharField(primary_key=True, max_length=30, verbose_name="Deployment Type",blank=True) def __str__(self): ...
user avatar
  • 461
-1votes
0answers
36views

Security Scanning of files other than source code [closed]

I have some files that I need to download and then upload to a specific location during execution of code. These files are other than source code files but required by the source code(.yaml, .xml, ...
user avatar
0votes
1answer
38views

Django orm latest data

reference class Board(model.Model): master = models.ForeignKey(User, on_delete=models.CASCADE) member = models.ForeignKey(User, on_delete=models.CASCADE) status = models....
user avatar
  • 19
1vote
1answer
39views

PROTECT vs RESTRICT for on_delete (Django)

I read the django documentation about PROTECT and RESTRICT to use with "on_delete". PROTECT Prevent deletion of the referenced object by raising ProtectedError, a subclass of django.db....
user avatar
1vote
1answer
27views

Getting URL parameters in request.GET (Django)

How can i get all of those url parameters (1, 12-18, 5,Happy birthday)? in Django https://domain/method/?1='12-18'&5='Happy birthday' I have tried parameter = request.GET.get("1", "...
user avatar
  • 545
0votes
0answers
31views

Django nested subqueries extremely slow

I'm working on a project in which users can have one profile, each profile can have many accounts, and an account can have many payments. The important parts of the models are the following: class ...
user avatar
0votes
0answers
16views

Django format change required in the session_data

My Django authentication code looks like below: @api_view(["POST"]) @authentication_classes((BasicAuthentication,)) @permission_classes((IsAuthenticated,)) def api_login(request): ...
user avatar
  • 645
0votes
0answers
24views

How to show foregin key of another django model in django admin fields or django admin fieldsets

I have two Django models: Bot and Seller. class Bot (models.Model): nick_name = models.CharField (verbose_name="Nick Name", max_length=100) wallet_coins = models.CharField (...
user avatar
  • 124
0votes
0answers
13views

Disable/Remove default permissions from django's third party library (django-celery-beat)?

When we setup django-celery-beat to my django project. It migrates the models from the library along with the default permissions. But, in my case I don't want those default permissions to be setup on ...
user avatar
  • 1,423
0votes
0answers
35views

Django-debug-toolbar not showing

I am using django 4.0.3 and django-debug-toolbar 3.2.4. For some reason, the toolbar is not showing on my server.I tried many ways but none of them worked for me. I will be very grateful for any help ...
user avatar
0votes
1answer
17views

Store list variable with Avg function in a Django aggregate

How to store and pass multiple Avg function in an aggregate the code below gives error of type views.py riasec_avg =[Avg('realistic'),Avg('investigative'),Avg('artistic'),Avg('social'),Avg('...
user avatar
  • 73
0votes
4answers
49views

How to have multiple return statement in python django?

In my Views.py, I try to download the csv file first to client side then only wish to redirect to another page. Below was my code def main(request): ... ... url = '//file1.km.in.com/sd/...
user avatar
  • 2,377
0votes
0answers
27views

What in this python program can make my memory goes to sky and freeze the program?

I have written a python program that connect to my mqtt server and process the data! BUt the memory start very low and get higher and higher over time! I would says pretty fast like in 2 hours it goes ...
user avatar
0votes
0answers
12views

Overwrite django rest default validation errors handler

I am using django-rest for my back-end and want to overwrite default errors for fields. My current code looks like this. class DeckSerializer(serializers.ModelSerializer): class Meta: ...
user avatar
-1votes
0answers
30views

expected bytes or bytearray, but got 'NoneType' in Django

I recieve a response from a payment gateway(paystack) and am trying to verify that events originate from Paystack to avoid delivering value based on a countefeit event. I have the error below anytime ...
user avatar
0votes
1answer
29views

DRF simplejwt do not updating the access token

I'm using simpleJWT with Django restframework and i get this problem when i tried to refresh the access token, i post http request sending the refresh token to the refresh endpoint, it suppose to get ...
user avatar
1vote
1answer
15views

In Django, how do I add a join table relation to an existing model?

I'm using Python 3.9 and Django 3.2. I have these models. The second is a join table for the first class Coop(models.Model): objects = CoopManager() name = models.CharField(max_length=250, ...
user avatar
  • 16k
0votes
0answers
8views

Django admin LogEntry error with remote authentication

I'm using Central Authentication System (CAS) with my Django services. User is authenticated by remote server and not Django auth itself. I have also changed Authentication Backend as follows : class ...
user avatar
  • 1,847
0votes
0answers
15views

What is the best wat to check if multiple forms in the profile is completely filled or not in Django?

I am working on a project where there are 4 forms and I want to show the profile completed status in percentage. Every form contains fields that are even required=False. Now my question is, how can I ...
user avatar
  • 135
0votes
0answers
12views

How do i use Task Errors exponential backoff in django-background-tasks?

I was trying out django-background-tasks on one of my projects and I have a case where I would like to retry a function if it throws an error after an hour. The documentation has details about Task ...
user avatar
0votes
0answers
20views

Django channels self.send() from custom function

Is it possible to self.send() from custom function inside consumer.py? I have a roulette game which runs inside a loop after every 30 seconds. Inside that loop I call a function to save the winning ...
user avatar
  • 33
0votes
0answers
22views

How to deserializer two Models in django?

enter image description herei'm sending two serializer models to api.py file... it is sending successfully but how to de-serializer both models in api.py views.py from django.http import HttpResponse, ...
user avatar
  • 3
0votes
0answers
16views

Python 3.10/Django 3.2.7: No module named 'MySQLdb'

This week I started working home and tried installing my project on my PC but it won't work. I cloned the git repo, installed MySQL Workbench and Server and stuff, installed Visual C++ stuffs and ...
user avatar
  • 37
0votes
0answers
19views

django token authentication not working properly

Hi Everyone i have configure token authentication in my project, when i post username and password on postman token are generating but when i added this token to access my api respose then getting [...
user avatar
0votes
1answer
32views

How to update django model automatically on due date?

I am trying to create a task manager app in Django. Tasks have a due date and is_complete status. class Task(models.Model): title = models.CharField(max_length=30) description = models.CharField(...
user avatar
0votes
0answers
14views

How to implement Two Factor Authentication in Django rest framework in social authentication?

In my Django project, I use DRF Social OAuth2 to do social authentication. Now my question is how to implement Two Factor Authentication when a user login by social authentication.
user avatar
  • 26
0votes
0answers
22views

django model structure (database structure)

I have one model many to one current state of this as follows: class A(models.Model): a_field = models.CharField() class B(models.Model): c_field = models.CharField() class C(models.Model): ...
user avatar
  • 326
0votes
0answers
13views

Django conditional inserts in multiple fields

I have two Django model: Object and Purchases. On the Object model, there are two fields: date_most_recent_purchase and date_first_purchase. I am inserting many dictionnaries, and each dictionnary can ...
user avatar
  • 787

15 30 50 per page
1
2 3 4 5
263