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

How to retrieve current Django user and feed it into a db entry

Question Closed: Please see response posted by Alasdair for solution. I am adding instances of Pets to a table: class Pet(models.Model): petName = models.CharField(max_length=100, default='My Pet') petImage =…
0
votes
1 answer

How to set a Model Field Type based on other model fields in django

I have the model below: class Actor(Model): VALUE_CHOICES = ( ('int', 'Integer'), ('str', 'String'), ('float', 'Float'), ('bool', 'Boolean') ) type = models.CharField(max_length=5, choices=VALUE_CHOICES,…
user875139
  • 1,599
  • 4
  • 23
  • 44
0
votes
1 answer

How to integrate django with postgreSQL

I have set up everything to migrate posgresql instead of sqlite. I have done everything like in several tutorials, also installed psycopg2 but I can't migrate my models. Settings.py database looks like this: DATABASES = { 'default': { …
tookas92
  • 225
  • 1
  • 4
  • 15
0
votes
1 answer

Django model with dynamic db tables

I am using Django to interface with another (JAVA) application that based on some events generates at runtime tables in the db with the same model. So I don't have a direct control over the DB. For example: Sensor1 id | value | time 1 10 …
palamunder
  • 2,555
  • 1
  • 19
  • 20
0
votes
1 answer

Django ForeignKey in same table about same attribute in different table

I have one model in my project. class users(models.Model): match_user = models.ForeignKey(User,on_delete=models.CASCADE) matched_user = models.CharField(max_length=25) Imagine that: match_user is 'Mete' and matched_user is 'Gizem'. Also…
0
votes
0 answers

Allow users to create new data models in Django app

I want to give users the ability to create new data models,and specify the relations between these models. My use case is a world simulator. Let's say it has Places, Characters, Incidents, etc models. The user should be able to create additional…
O James
  • 189
  • 1
  • 12
0
votes
0 answers

ajax called django form loosing value on adding another form

i am new to django and jquery and trying do develop first application. My problem is django generated modelformset field values are going blank (reset to default) when I add another (second and subsequent) modelformset to div via ajax…
Ravi
  • 1
  • 3
0
votes
1 answer

How to efficiently use Django query and Q to filter each object in a queryset and return 1 field value for each unique field in the queryset

I have query that returns the following queryset: results = , , , , , , ]> The __str__ representation of the model is name…
0
votes
0 answers

Best way to have order_by and distinct different columns in Django?

I'm trying to do the following with a PostgreSQL DB: team_updates = TeamUpdate.objects.filter(team__in = TeamStarred.objects.filter(user=request.user).values('team')) team_updates =…
0
votes
0 answers

Programming Error when trying to delete User in Django Admin Panel

I got a web page online and everything works fine. Except when I try do delete a user I get the following error: {ProgrammingError at /admin/auth/user/ operator does not exist: text = integer LINE 1: ...OIN "auth_user" ON…
Lukas Humpe
  • 421
  • 3
  • 10
0
votes
2 answers

Django - What is the best way to store in the DB answers that can be numerical or text?

I'm working on a student survey project. The model that stores the questions is something like: ID Question Type 1 is good teacher? Choice 2 What do you like about Open-answer the teacher? Then in…
ozo
  • 883
  • 1
  • 10
  • 18
0
votes
0 answers

Update a Model value in database: django

I've created a model in Django which is as follows: class LatestSavedKeyPassword(models.Model): key_password = models.CharField( max_length=20, default='', blank=True, help_text="System Generated, Do Not…
Cool Breeze
  • 738
  • 2
  • 10
  • 26
0
votes
1 answer

how to get flat value from muitiple values_list? Django database

I am getting postgresql data from my server and fill out the table down below. I was able to join 3 different tables and get columns I want from them. However, it gives me none-formatted object. Is there any way I can fill out the table using joined…
Angie
  • 9
  • 7
0
votes
1 answer

django 3 tables queryset

I have 3 tables populated from my Postgresql legacy DB. I was able to get some data from vlan table but I have a trouble getting all the data from 3 different tables and put them into a table I created in the picture. I have tried multiple querysets…
Angie
  • 9
  • 7
0
votes
1 answer

Django Database Queryset No Field Information

When I run a queryset through my views and pass it to the template all I get is the following: , , , ,…
Alex F
  • 33
  • 1
  • 6