Tagged Questions
0
votes
2answers
30 views
Django: How to write query to sort using multiple columns, display via template
I'm quite new to Django, and not too experienced with MVC, DB queries.
I have a Customer table which includes customer_name, city_name, as well as a state_name (pulled from a foreign key table). In ...
0
votes
0answers
19 views
Django + DatabaseError: Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type
I am having some issues with GeoDjango, Postgis and Postgres. I have a model with a PointField on called pnt, this contains the lng lat of an item.
class Profile(models.Model):
pnt = ...
0
votes
0answers
17 views
Django with postgresql: auto_increment field starts at 0 after deserialization
On my production postgresql database, in heroku, I've used django deserialization to populate models from json files.
On sqlite this works fine. However on postgresql it seems that all the autofields ...
0
votes
0answers
16 views
Working with pending trigger event in Django 1.4
@transaction.commit_on_success
def action_init_address_receipt(cls, request):
execute_sql('alter table finance_addressreceipts disable trigger user;')
execute_sql('select ...
0
votes
1answer
20 views
Django HStore: How to override a key-value model field's __getattr__ and __setattr__
I've been getting my feet wet with using hstore in Django, through the django-hstore module. A big advantage to using hstore is that it allows for key-values to be stored in a field while providing ...
0
votes
1answer
19 views
Why does django/tastypie with postgresql concatenate models_?
I am using postgresql with django and tastypie. I have my models and resources set up and working with mongodb for certain models and am trying to use postgresql for relational data models. For some ...
0
votes
0answers
15 views
how can i send an image from objective-c through a django service to be stored in postgresql [on hold]
I have an IOS objective-c application that takes pictures, I wish to pass the picture to be stored in the database (postgresql), using django framework.
can anyone point me to a tutorial or help with ...
1
vote
2answers
43 views
“ProgrammingError: column ”genre_id“ of relation ”music_album“ does not exist” while the column does exist
I have the following models :
class CulturalDocument(CacheMixin, models.Model):
...
uuid = UUIDField(unique=True)
class Genre(CulturalDocument):
name = models.CharField(max_length=32)
...
0
votes
2answers
49 views
pip install psycopg2 venv freezing
So I'm trying to install psycopg2 in a virtualenv so that I can deploy a Django app to Herkou. I ran into a pg_config executable not found error, so I reinstalled PostgreSQL, but this time via ...
0
votes
0answers
22 views
Django tests don't find the postgres extensions
I am running python tests like this.
python manage.py test
.....
[snip]
.....
LINE 1: SELECT (idx([snip])...
^
HINT: No function matches the given name and argument types. You ...
1
vote
1answer
24 views
SQL within Django - “order” field for the records in table - defined by user, can be arbitrary, changes constantly - how do I do this?
So I have an application in which a user creates a list. The user also orders the items in the list and can add and remove items from the list. If the user logs out and then logs in from another ...
0
votes
0answers
11 views
DJango creating a model of existing table with bigserial
I'm using DJango 1.6 with python 2.7, I have an existing postgresql+postgis database
the tables declare a column of type bigserial as their primary key
for example:
CREATE TABLE MMCompany
(
...
-1
votes
1answer
29 views
Why doesn't Django/PostgreSQL reuse primary key values after objects with that primary key have been deleted? [duplicate]
I'm trying to figure out why Django (or PostgreSQL, not to sure at which level it is) doesn't reuse primary keys from objects that have been deleted. When objects are created, they all have an id ...
0
votes
0answers
19 views
How big can Django primary keys get?
Is there a maximum value as to how high pk values for a model can get? For example, for something like an activity feed model, the pk's can get really large.
Ex, "Kyle liked this post", "Alex ...
0
votes
1answer
30 views
DJango 1.6 model.BinaryField causes TypeError
I've created a class model using DJango 1.6 with python 2.7 as follows:
class Company(models.Model):
Name = models.CharField(max_length=150)
PhoneNumber = ...
1
vote
0answers
44 views
django-hstore compatibility issue with Django 1.6
django-hstore seems to be not compatible with Django 1.6. I have this error on runserver. With Django 1.5.5 everything was correct. Any idea what could be the problem?
Note that I have changed the ...
0
votes
0answers
15 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 ...
0
votes
0answers
26 views
Django postgresql on Heroku DatabaseError value too long for type character varying(1000)
I'm getting this error when saving a Django Model Object:
DatabaseError: value too long for type character varying(1000)
Inside the model there is a textfield:
models.TextField()
I'm saving ...
0
votes
1answer
41 views
Error when attempting to install django-toolkit within a python virtualenv
I'm relatively new to Python, extremely new to Django and Heroku, and also rather new to working in the terminal.
I'm attempting to follow the instructions on setting up a Django Heroku project found ...
1
vote
0answers
21 views
Django local flavor select widget list
My question is pretty siemple, but is being hard for me to find an easy way to do this.
I have a website where I need to make three dropdowns:
One for countrys
One for regions
One for sub-regions
...
0
votes
1answer
29 views
Django-south: “! These migrations are in the database but not on disk:”
I am trying to migrate a database, after modifying the schema in the models.py file of my app in Django. When I try to migrate using ./manage.py migrate <app-name>, it gives the following ...
1
vote
1answer
29 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.
...
1
vote
2answers
113 views
+50
How to show database errors to user in Django Admin
Background: my Django application sits onto top of a pre-existing Postgresql database. This database has a very complex network of triggers and constraints.
Question: In the Django Admin, if a user ...
0
votes
0answers
40 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 ...
1
vote
1answer
34 views
GeoDjango touches function is slow
First off, here's my setup:
Python 2.7.6
Django 1.6
PostgreSQL 9.3.1
PostGIS 2.1.1
I have loaded up the Natural Earth countries and states datasets into PostGIS. Here's the Django model I'm using:
...
0
votes
0answers
27 views
combining results from multiples tables in postgres
I am trying to perform full text search on 3 different tables.
The names of tables are,
Tag (has a field called 'name' and has a many to many relation with Post)
Reply (has a field called 'html' ...
0
votes
0answers
56 views
pytz, Django 1.5, and postgres: DST time zone issues
I've created an events site with Django 1.5.4 and postgres 9.1. The time just changed for "fall back" and all the date/time data entered by admins before the time change are now an hour off.
In my ...
3
votes
0answers
63 views
How to duplicate the amount of data in a PostgreSQL database?
In order to evaluate the load of our platform (django + postgresql) I would like to literally duplicate the amount of data in the system. Its a bit complicated to create mocks that could emulate the ...
0
votes
0answers
19 views
Postgres insert returning Raw Django Model query not working?
I have a simple model I am inserting into. I am using the following syntax:
m = Model.objects.raw("insert into my_model (col) values ('test') returning *")
In postgres, this returns the identical ...
0
votes
0answers
86 views
How to debug “could not receive data from client: Connection reset by peer”
I'm running a django-celery application on Ubuntu-12.04.
When I run a celery task from my web interface, I get the following error, taken form postgresql-9.3 logfile (maximum level of log):
...
0
votes
1answer
51 views
Difficulty opening port 5432 for PostgreSQL on Ubuntu 12.04
I'm trying to get a postgres database talking to a django installation.
I've followed the steps details here: http://blog.iiilx.com/programming/how-to-install-postgres-on-ubuntu-for-django/
However, ...
0
votes
0answers
74 views
Django (postgresql-psycopg2) connection pool: Simple vs Threaded vs Persistent ConnectionPool
I was looking at db connection pool implementations to use in my Django app using postgresql db backend, and came across this very recent wrapper package implemented for psycopg2 -
...
0
votes
1answer
104 views
Django unable to load test fixtures, IntegrityError
I'm using Saleor/Satchless to power and e-commerce site (inherited the project). I couldn't find a Saleor mailing list so posting here instead.
I dumped the DB to create some test fixtures.
...
0
votes
0answers
30 views
Django admin default ordering of custom fields
I have the following django admin exceprt:
class TagAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("title",)}
list_display = ['title', 'total_videos', 'total_active_videos', 'weight', ...
0
votes
0answers
43 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': ...
0
votes
0answers
30 views
pg_restore from heroku - constraint does not exist
I'm migrating a Django app from Heroku to a dedicated server. I've created a PostgreSQL backup:
$ heroku pgbackups:capture
$ curl -o latest.dump `heroku pgbackups:url`
I've created the new ...
1
vote
2answers
30 views
Heroku deleting my images in Django
I'm doing a Django application and using heroku, but when I upload an image everything goes good, but after about 2 hours, heroku delete my images. I dont know what is happening. Im using a postgres ...
1
vote
3answers
337 views
Django can't find libssl on OS X Mavericks
I'm trying to get Django running on OS X Mavericks and I've encountered a bunch of errors along the way, the latest way being that when runpython manage.py runserver to see if everything works, I get ...
0
votes
1answer
26 views
Django how to customize table name and foreign key field
Working with existing database. All existing tables has named space prefixed tbl_. How can I create model class or configure django settings to prefix tbl_ before querying or syncing.
Also each child ...
0
votes
1answer
23 views
Django: Many-to-many relation edit
I have a model called Connector that has a foreign key to profile and a many-to-many relation with an ExternalAttribute model. The ExternalAttribute model has a list of attribute objects that are ...
1
vote
1answer
50 views
Django Save Object based on PK and another field
I am trying to use a partitioned table in postgresql together with a Django installation.
From Googleing the subject, I found out, that Django does not support partitioning by itself, so I did the ...
1
vote
2answers
47 views
SELECT using psql returns no rows even though data is there
I'm using Django + Postgres. When I do a SQL query using psql,
e.g. \d+ myapp_stories
correctly shows the columns in the table
But when I do SELECT * FROM myapp_stories, it returns nothing. But ...
0
votes
1answer
58 views
Postgresql with Postgis Geodjango Installation
I'm trying to get Geodjango set up with Postgis but cannot enable the Postgis extension in the database. I am following the settings that are found on the Geodjango Documentation, but when I hit this ...
0
votes
1answer
36 views
Subquery in select Django
Trying to run a complicated query in Django over Postgresql.
These are my models:
class Link(models.Model):
short_key = models.CharField(primary_key=True, max_length=8, unique=True, blank=True)
...
0
votes
0answers
25 views
Django application “GeoNode” gives message “DLL load failed” on windows
I'm trying to install GeoNode which is a Django application on windows through these simple steps on this page. I've reached a point where is the GeoNode is installed and I've created my postgres ...
0
votes
1answer
93 views
invalid literal for int() with base 10: 'Micro' at Django web-page
Im inserted with sql-script this data:
INSERT INTO "siteDB_accounttype" VALUES
(1,'Micro'),
(2,'Standart'),
(3,'МТ-ECN');
And have this code at Django(used Python 2.7):
1) views.py
def ...
1
vote
0answers
50 views
Optimizing Django-Tastypie-Postgres-Gunicorn to prevent Heroku request timeouts (H12) errors
I have a Django app running on Heroku for almost a year. I occasionally see request timeouts because a request took more than 30 seconds. The request is a fairly straightforward API call to Tastypie
...
0
votes
1answer
28 views
Running python manage.py command from django with arguments
I have the command :
./manage.py dbbackup --clean --compress
provided by the django-dbbackup app which performs a backup of my PostgreSQL database to Amazon S3. I am trying to run this command ...
-1
votes
1answer
33 views
How to use django-dbbackup?
I am trying to use the django-dbbackup tool to backup my PostgreSQL database. I have setup everything as written in the documentation. However, when I run in the python shell:
import dbbackup
...
0
votes
1answer
51 views
Django Auth Model Issue - AUTH_USER_MODEL Not Installed
Trying to debug this error with getting a Django project running
ImproperlyConfigured: AUTH_USER_MODEL refers to model 'accounts.User' that has not been installed
Running
python manage.py migrate
...