Use this tag for PostgreSQL issues which are to be solved in accordance with Django coding best practices.
Questions tagged [django-postgresql]
207 questions
0
votes
1 answer
Django Enforce unique combination of pair of foreign keys
So let's say I have the following Django models defined:
class Model(models.Model):
model_id = models.IntegerField(default=0, unique=true)
content = models.TextField()
class ModelRelation(models.Model):
relation_id =…

JackTheHunter
- 3
- 2
0
votes
1 answer
Docker and POSTGRESQL
I create new project using Docker on Django. when I write settings to connect to Postgres it has some Error - (conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name…

Luiba R
- 1
- 1
- 2
0
votes
0 answers
How to add User model to Profile model in Django right way?
I am new to Django and trying to create a Profile(Patient) model. Here are my models.
from django.db import models
from django.contrib.auth.models import User
class Patient(models.Model):
user = models.OneToOneField(User,…

RiadSaidur
- 147
- 2
- 12
0
votes
2 answers
why i cant save m2m relationships in Django 3
recently i have upgrade and app to django 3, and i'm using a many to many relationship to define the people i want to send and email, in this way:
class Contact(Master):
name = models.CharField(max_length=100, blank=True, null=True,…

beren5000
- 100
- 10
0
votes
1 answer
Switch from SQLite to postgres, postgres asking for a password
Two things to note: One, I am executing these commands with my virtual environment running. So terminal appears as (env):. Two, every time I tried to enter su postgres, it asked me for a password.
I am reading a book on Django(using a mac), the…

Justin
- 1,329
- 3
- 16
- 25
0
votes
2 answers
value too long for type character varying(25)
I have troubles uploading a CSV file into my database, when I try to upload the file I get a "value too long for type character varying(25)" error message for the field performance_exccy (see below for my django model). This error message started…

Daniel
- 963
- 1
- 12
- 29
0
votes
0 answers
save(force_update=True) returns is None DJANGO, it is possible to return with rows affected?
SGBD is PostgresSQL
I am using it to identify if there has been a change, if I would make an update in a date and time field, since once using auto_now = True it always enters my model and makes the update date…

mascDriver
- 35
- 9
0
votes
1 answer
Django Arrayfiled: Annotate queryset with the first item in the arryafield
I have a model that can be represented by something like this.
class BackPack(models.Model):
person = models.ForeignKey(Person, db_index=True,
related_name='back_packs', on_delete=models.CASCADE)
candy =…

davenenglish
- 108
- 7
0
votes
1 answer
Django PostgreSQL - Fuzzy Searching on single words
I'm using Django's builtin trigram_similar lookup and TrigramSimilarity class to create a fuzzy searching using a PostgreSQL database. This way, I filter titles of articles. The problem is, this filters based on the whole title. I want to filter it…

Myzel394
- 1,155
- 3
- 16
- 40
0
votes
0 answers
About installation issue of postgreSql
When I tried to install Postgre SQL in my windows 8.1 when it almost comes near to complete installation showing this error:
Problem Running Post-Install Step. Installation May Not Complete Correctly failed to start the database server.
Please,…

Manvir Choudhary
- 23
- 5
0
votes
0 answers
How do I condense annotated queryset results based on a particular field?
Here's a fun one. Maybe someone can figure this out. Say I have a queryset something like the one below and want to get leads by month per company.
Company.objects.annotate(
month=TruncMonth('leads__date_received')
…

meesterguyperson
- 1,726
- 1
- 20
- 31
0
votes
1 answer
How to save an array of text in PostgreSQL using Django model.?
I am trying to save an array of text containing category types for a hotel system which looks something like this ['category-1', category-2', category-3, category-4] . I am using category_type = ArrayField(models.CharField(max_length=200),null=True)…

Erlich Bachman
- 112
- 11
0
votes
2 answers
Select the book with the least amount of pages for each author in a category
These are my models:
class Author(models.Model):
name = models.CharField()
class Category(models.Model):
name = models.CharField()
class Book(models.Model):
pages = IntegerField()
author = ForeignKey(Author)
category =…

Joseph Smith
- 29
- 5
0
votes
0 answers
Viewing requests between Google container and Cloud SQL
We have a GKE application container running Django that connects to a Postgres database on Cloud SQL via Private IP. The application is configured to run 10 django processes per pod. Whenever a new pod is spun up (either when deploying new code or…

jcm
- 1,781
- 1
- 15
- 27
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…

Omar Jandali
- 814
- 3
- 20
- 52