Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
36 views

i set database connecting statement in settings.py it returns no biulding tools and ask to install mysqlclient. django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you ...
FATHIMATH SAHALA's user avatar
0 votes
1 answer
3k views

Apologies in advance if this type of question already exists with a solution. I have been trying to get this solved for about 2 weeks now. So I had a Django project, which initially used the default ...
tan_000's user avatar
  • 31
0 votes
2 answers
91 views

Hi Iam try to select from mysql using Django my models.py from django.db import models from django.db.models import Q class Series(models.Model): id = models.IntegerField(primary_key=True) ...
Ghost Ghaith's user avatar
0 votes
1 answer
97 views

I've been trying to delete an existent instance from the user table (mysql) but I keep getting error from the user.delete() this is the my viewpoint: @api_view(['GET', 'PUT', 'DELETE']) def ...
usef's user avatar
  • 45
0 votes
1 answer
211 views

I'm trying to send a query through Django python I also try to block any sql injection exploits Can someone explain to me how messaging is done LIKE Query for example "SELECT * FROM admin WHERE ...
Ghost Ghaith's user avatar
0 votes
1 answer
85 views

In an existing project, how can I implement a method using which I can redirect it different database(Write, Update & read) without modifying existing Django queries? If I have 2 queries: MyModel....
SUP's user avatar
  • 359
0 votes
0 answers
734 views

Could you please help me find an example of a simple login page where the users can be authenticated using user/password from a database postgres or mysql(I can change that afterwards from mysql to ...
BosnianFlajter2's user avatar
0 votes
0 answers
322 views

I've updated the Django model field from CharField to TextField. I got the below error while applying migrations in MySQL. django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'my_column' ...
DilLip_Chowdary's user avatar
1 vote
0 answers
93 views

I try to run "pip3 install mysqlclient" on macos for an app in django and it gives me this error. I'm using a venv virtual environment, the python version used is 3.10.5 pip3 install ...
Federico Tuñon Alves's user avatar
3 votes
3 answers
2k views

Using django with a MySQL DB and given these models: ModelB ---FK---> ModelA - ref_type - ref_id ModelC I want to get all the ModelC for each ModelA via an annotation. I tried many ...
Michael's user avatar
  • 8,878
0 votes
1 answer
90 views

I have written a query to re-order objects based on the values I get in the API request. Below is the sample code I have written: @action(detail=False, permission_classes=[], methods=["PUT&...
Shreehari Vaasistha L's user avatar
1 vote
1 answer
98 views

I have a django 3.2/mysql website. One of the tables, Flights, has two columns, angle and baseline. These two columns are combined in a view to display the value altitude using the formula altitude = ...
user1045680's user avatar
1 vote
0 answers
328 views

I have an unavoidable bulk_create deadlock in my code. I decided to handle this part inside an atomic block and re-issue transaction when deadlock happened. Something like this: while True: try: ...
motam's user avatar
  • 757
1 vote
2 answers
2k views

I have a database of articles that I want to search through. I had been using normal Django ORM to search, which was getting way to slow and then I got to know a little about Indexes in Django. I'm ...
DJay's user avatar
  • 1,292
2 votes
1 answer
148 views

I have the following MySQL query that displays the average value per 10 minute interval: SELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(date_time) / 600) * 600) AS interval_date_time, AVG(some_value) AS ...
Robert Berge's user avatar
1 vote
0 answers
123 views

When I am executing ModelName.objects.filter(firstName__contains="MyName") it returns an empty queryset but when I am executing it's SQL equivalent in dbshell it is fetching the rows ...
Debdut Goswami's user avatar
1 vote
0 answers
287 views

I am trying to create a constraint on my Offer table, which has an offer_id (charfield) and a product_id (foreign key) where an offer_id can only be combined with 1 product. It is not allowed that an ...
Mathijs's user avatar
  • 521
1 vote
1 answer
3k views

I'm using Django with below config in settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': '-', 'USER': '-', 'PASSWORD': '-', ...
Atul Goyal's user avatar
  • 3,531
0 votes
0 answers
525 views

i have a MySQL database in cpanel and i want to connect my django project to this database when i try to connect it it show a message that i can't connect to localhost but i don't want to connect to ...
Achraf El Hadi's user avatar
0 votes
0 answers
539 views

I am trying to migrate my Django app from SQLite3 to MySql. I took following steps Configured a new empty database on MySql. I did not create any tables because I assumed that the tables will be ...
user1933205's user avatar
0 votes
1 answer
720 views

I have a data.dump file for mysql and am trying to use manage.py loaddatato fill my db with this data file, but getting this error: CommandError: Problem installing fixture '˜/Downloads/data': dump is ...
Pooya Kamranjam's user avatar
1 vote
2 answers
1k views

As we know, Django=3 is supporting JSONField . I am trying to save JSON data in my Django Project using JavaScript, i have take data in a input field which looks like: [{"id":1,"Name&...
Azharul Islam Somon's user avatar
1 vote
1 answer
407 views

I was going to update to using sqlite database into the mysql database on my django project. after replaced settings.py like bellow: ` DATABASES = { 'default': { 'ENGINE': 'django.db....
KangDo's user avatar
  • 79
1 vote
1 answer
385 views

So, I was re-configuring my SQL and decided to move back from my.conf to settings.py (context: https://docs.djangoproject.com/en/3.2/ref/databases/#mysql-notes) 'read_default_file': '/path/to/my.cnf',...
user16241015's user avatar
2 votes
1 answer
9k views

I currently use django 3.2 and MySQL as database, I want use MySql Json Field. For this reason use django-mysql third party package in my project. After create model got this Warning: (django_mysql....
A.Motahari's user avatar
0 votes
1 answer
874 views

I have the following models: class Creditor(models.Model): terms_of_payment = models.IntegerField( blank=False, null=False ) class Invoice(models.Model): creditor = models....
Pooya Kamranjam's user avatar
1 vote
1 answer
1k views

I already have and database in MySQL for my one Django project. I need to make two separate Django projects share the same database. project1/settings.py: DATABASES = { 'default': { '...
Azharul Islam Somon's user avatar
0 votes
1 answer
224 views

I am creating a Django app where the primary keys are AutoFields. i.e. I am not manually assigning any field as primary key in my models. I need to use mySQL. I will need to export all the data to ...
mad_accountant's user avatar
1 vote
1 answer
158 views

How can i make an efficient django orm query, which will compare ids from the list of dictionaries with the ids as foreign key in other model, e.g i have two models Product: product_name=models....
Muhammad Nabeel's user avatar
0 votes
1 answer
300 views

I am trying to run my Django project on a VPS. My Django project uses MySQL. While running it on my local computer I used the following code to connect MySQL to Django DATABASES = { 'default': { '...
Leman Kirme's user avatar
0 votes
1 answer
273 views

I cannot use mysqlclient package in the hosting server because it is a shared hosting server and they would not let me have a root privilige!! so I found about the mysql-connector adapter, I guess it ...
Omar Redwan's user avatar
0 votes
1 answer
1k views

I connected my Django with mysql database and ran a sql script to make a database and ran migrations on my django project and I had no errors but to to use the database I had to use python manage.py ...
chirayu rathi's user avatar
0 votes
0 answers
152 views

I'm new to Django and I'm facing some issues installing mysqlclient for my application running this command pip install mysqlclient I'm getting an error ModuleNotFoundError: No module named 'pip....
Ali HS's user avatar
  • 99
1 vote
1 answer
660 views

I am trying to make this transaction mysql compatible. As mysql don't allow the current operation. MySQL doesn't allow updating the table you are already using in an inner select as the update ...
Soban Javed's user avatar
2 votes
1 answer
85 views

Why does my data look like this? can i make the value in user_id? if i delete the def create_user_profile it will create nama, nik, email, nomor_hp. but user_id is null in the picture, id 1 and 2 i ...
Naufal's user avatar
  • 79
0 votes
1 answer
559 views

What I tried: Installed the MySql server on the EC2 instance. In the security group of the instance added an inbound rule to connect over shh from all source Created a database and user Given that ...
Krishna Gupta's user avatar
0 votes
1 answer
113 views

I am new to the Django framework. I want to create generic controller which can accept body as follows { "operation":"select", "fields":["user_id","user_name","user_email"], "table":"user"...
Lalit Jeevanlal Kohli's user avatar
0 votes
2 answers
1k views

So I have a MySQL database for my Django project which I think is located in the default directly (wherever that should be). When I want to move my Django project to digital ocean, how do I move that ...
arujbansal's user avatar
0 votes
1 answer
71 views

I am want to: 1. save data from a HTML form to MySQL 2. delete data from mySQL which is entered through HTML form. The save functionality is working. While there is error in delete functionality. ...
tolearntoseek's user avatar
0 votes
1 answer
2k views

I'm working with 2 Databases, 1 external not managed by Django and the other internal. Thi is the external database now working on models and in Admin site: class Client(models.Model):# IMPORT FROM ...
Alex Anadon's user avatar
0 votes
1 answer
1k views

My table is defined as below. class Role(models.Model): user = models.ForeignKey( settings.AUTH_USER_MODEL, to_field="email", db_column="user", on_delete=models....
adshin21's user avatar
  • 188
0 votes
2 answers
109 views

I want to know how to deal with this task. here are the details: this is product_feature model class Feature(models.Model): has_value_choice = [ ('y', 'Yes'), ('n', 'No'), ] ...
Sahil shaikh's user avatar
0 votes
2 answers
101 views

I am using django 2.2, python 3.6.8 on ubuntu 18.04 with mysql server. I have courses, student and courses_student tables. There is a many-to-many relation between courses and students. In Courses ...
ivbtar's user avatar
  • 877
0 votes
0 answers
253 views

I am using django 2.2 with python 3.6.8 on ubuntu 18.04. I created a model like below : @reversion.register() class Courses(BaseModel): coursecode = models.AutoField(primary_key=True, ...
ivbtar's user avatar
  • 877
0 votes
1 answer
192 views

The following diagram is from my database Database schema I have the following model that represents that schema: class Finalproduct (models.Model): idfinalproduct = models.AutoField(...
Uribe2304's user avatar
1 vote
2 answers
896 views

I'd like to store a list of integers in a MySQL field. My current workaround: import datetime from django.db import models class myModel(models.Model): testList = models.CharField() def ...
poultrynews's user avatar
2 votes
0 answers
124 views

Example I'm trying to annotate objects using data from a related model's DateTimeField. class Author(models.Model): name = models.CharField(max_length=256) class Book(models....
aniline hates nazis and pedos's user avatar
0 votes
1 answer
2k views

I have added arrayfield to model in my application. Below is my model class employees(models.Model): firstName=models.CharField(max_length=10) lastName=models.CharField(max_length=10) ...
mounika kommineni's user avatar
0 votes
0 answers
34 views

I have made a table "Offenses" in my database which works fine, it has a primary key named "id" Now i want to create another table with name offense_category. and want to create a foreign key that ...
Kiran's user avatar
  • 21
2 votes
1 answer
9k views

I have this model in my Django project: class Institution(models.Model): name = models.CharField(unique=True, max_length=100, blank=True) description = models.TextField(max_length=500, null=...
rahnama7m's user avatar
  • 977