Questions tagged [django-database]

django-database refers to database backends that Django supports out of the box

refers to database backends that Django supports out of the box.

This tutorial help you to make application using mongodb database. enter link description here

664 questions
0
votes
1 answer

Retrieve only one record with different variants in Django Database/models using sqlite3

In my database I have these 3 records under title fields. They have different IDs. { "result": [ { "id": "32b05a2f-e52f-55c6-8314-090bdd82e588", "movie": {"advisory_rating": "PG", "canonical_title": "(3D/4DX)GEOSTORM", "cast":…
0
votes
1 answer

Django - FileField won't upload to database

I'm trying to upload some file with a FileField but when I hit the submit button and run the form.save() I have a new line in my database table but the file I tried to upload is not there. I've been searching for some time to solve my problem but…
Thurluth
  • 5
  • 4
0
votes
1 answer

Improve Django database performance by oriding or index?

I'm working on a project in which around 3 million records are saved in a MySQL database. The model is like: class Record(models.Model): rec_type = models.CharField(...) rec_value = models.FloatField(...) rec_prop1 =…
Hansen Zhao
  • 27
  • 2
  • 7
0
votes
1 answer

How to store an object in a django model?

I am receiving an object from the frontend as a parameter alongside with other parameters. How can I store that object into my model? I've tried JSONfield but not sure if its the best way to do it. This will be a tracking service like Mixpanel this…
Naim Mustafa
  • 314
  • 2
  • 14
0
votes
1 answer

Django starting id with a specific number?

i want to start using a app with a specific id and when i migrate i have a error that is saying that i dont have permission or does not exist. Well i am already db_owner so maybe the error is when i do ALTER SEQUENCEon my migrations. My…
Pedro Mariz
  • 151
  • 2
  • 20
0
votes
0 answers

How to add multiple hosts to django database?

The connection URL to my MySQL server is like so jdbc:mysql://server1:3306,server2:3306,server3:3306/mydb After I parse and extract the hosts and ports, how can I pass it in Django DATABASES section below? DATABASES = { 'default': { …
MajorXbox
  • 503
  • 1
  • 4
  • 13
0
votes
1 answer

Django: Retrieving database entry based on user instance

I am have an app that allows patients to reserve doctor's appointments. On the doctor's portal, I want to retrieve all appointments that is connected to the doctor using the portal. The problem is "Cannot query "Person Name": Must be "Doctor"…
0
votes
2 answers

How to properly pull from a database using Django and template tags

I'm trying to create a web application using Django that displays information about employees and schedules. I have the data for the employees stored in the Django database but when I try to pull from it and display information in a table nothing…
0
votes
1 answer

create db.connection custom class wrapper, keep getting "django.db.utils.InterfaceError: cursor already closed"

im trying to make custom class wrapper for "django.db.connection", but im keep getting "django.db.utils.InterfaceError: cursor already closed". the working code is something like this if without custom class wrapper (copied from ./manage.py shell)…
anovsiradj
  • 43
  • 3
  • 9
0
votes
1 answer

How to structure views for database pulling and manipulation

I am having difficulties understanding how best to structure my views. I am pulling data on various users and creating variables that summarise some of these variables (such as occurrences per week etc). This is so I can graph these summary…
0
votes
2 answers

django not able to save all incidents in database

I have a working code which gets all incident details. But i am unable to save complete data in database only the last record gets saved def incidents(request): incidentsServicenow = IncidentsServicenow() c = pysnow.Client(instance='', user='',…
0
votes
1 answer

Is it possible to create and connect Django databases from the application?

Is it possible to create and connect Django databases from the application? An example. In a system at the time of user registration, at that time django create a new database generates the migrate and create a new database with the exact settings.
marcelo.delta
  • 2,730
  • 5
  • 36
  • 71
0
votes
2 answers

Migrating django database from sqlite to postgres error with psycopg2

I am trying to switch my django database from sqlite to postgres on my local machine. I am getting the following error when I try to run python manage.py migrate File…
0
votes
1 answer

How i can create Model or form for Django admin that not create table in database ?

This technique create table in database but i don't want create table into database. class Email(models.Model): to = models.EmailField(null = False) subject = models.CharField(max_length = 255, null = False) message =…
0
votes
0 answers

Two forms in one model. Combining values for table databases

I have simple model in django that looks like : class TimeTable(models.Model): title = models.CharField(max_length=100) start_time= models.CharField(choices=MY_CHOICES, max_length=10) end_time = models.CharField(choices=MY_CHOICES,…