All Questions

Tagged with
Filter by
Sorted by
Tagged with
3
votes
1answer
3k views

Django filter - iregex to match complete word only

So I've been trying to implement a search feature where by a user can enter a keyword and look up users. The search method is supposed to look up exact word matches within the fields of the users e.g ...
3
votes
1answer
191 views

How to efficiently write DISTINCT query in Django with table having foreign keys

I want to show distinct cities of Users in the front end dropdown. For that, i make a db query which fetches distinct city_name from table City but only those cities where users are present. ...
2
votes
1answer
465 views

django & sql - how can I efficiently store and update sort order information associated with records in my database table?

So I have a Django app and one of the tables is basically a list of items. The user may choose to rearrange the order of this list. When they do this, I want to preserve this information so that the ...
1
vote
2answers
542 views

Permission denied error with PostgreSQL and Django. Giving rights to PostgreSQL user admin

I have Django app with PostgreSQL. The app has those environment variables: DATABASE_HOST=localhost DATABASE_USER=admin DATABASE_PASSWORD=admin Here is psql output: postgres=# CREATE USER admin ...
1
vote
0answers
3k views

could not translate host name "postgres" to address

I use PostreSQL and Django 1.8 in my app. I have an error: django.db.utils.OperationalError: could not translate host name "postgres" to address: nodename nor servname provided, or not known but I ...
1
vote
0answers
404 views

Django query slow on profiler but fast on PostgreSQL

Django-live-profiler is showing me a query executed a huge number of time with a slow average time. So the total execution time of the request is high. When I execute the same request directly on ...
1
vote
0answers
87 views

How can I improve this ugly Postgresql query generated by my possibly poor Django code?

I'm doing this in a Django view: def by_gear(gear): types = { 'imaging_telescopes': Telescope, 'guiding_telescopes': Telescope, 'mounts': Mount, 'imaging_cameras': ...
1
vote
2answers
378 views

How to supply SQL functions and views required for testing Django app

I've created a file <APP>/<MODEL>.sql according to the Django docs in order to make use of a hook to pass arbitrary SQL after syncdb is run. Inside this file are two function declarations ...
0
votes
1answer
899 views

Handling unique constraint exceptions caused by inserting duplicate values

I have this table (DDL): CREATE TABLE corpname_skill ( id SERIAL NOT NULL CONSTRAINT corpname_skill_pkey PRIMARY KEY, guid ...