Re: Basic GenericForeignKey Question

2016-09-21 Thread TheBeardedTemplar
t; > 2016-09-21 16:41 GMT+02:00 TheBeardedTemplar <thebeard...@gmail.com > >: > > Hey all, > > > > I'm just getting started with GenericForeignKeys and I've run into a > small > > point of confusion. I'm implementing a very general permission system as &

Basic GenericForeignKey Question

2016-09-21 Thread TheBeardedTemplar
Hey all, I'm just getting started with GenericForeignKeys and I've run into a small point of confusion. I'm implementing a very general permission system as follows: class Permission(models.Model): """ This stores permissions for a single object. """ #These 3 fields are used to

Re: DoesNotExist on ForeignKey Access

2016-08-12 Thread TheBeardedTemplar
On Friday, August 12, 2016 at 1:19:17 PM UTC-6, Todor Velichkov wrote: > > Some more code will be helpful, for example the model structure, how do > you define the the `ForeignKey`? How do you subscribe for the signal? > You are saying that with sleep(1) the code works fine, is this mean that

DoesNotExist on ForeignKey Access

2016-08-12 Thread TheBeardedTemplar
Hey all, I'm quite stumped with a problem that recently started showing up in my code. I have a model called a Widget that can have an associated Blob object. When a Widget is deleted, I want to make sure that the Blob associated with it isn't used elsewhere, and if it's not, delete it. I do

Making queries with custom SQL

2016-06-16 Thread TheBeardedTemplar
Hey everyone, The bulk of my database consists of a tree of models (called Node), more than 200,000 of them, and I very regularly need to make large queries to get subtrees which I'm finding is causing a significant slowdown. I'm using postgreSQL and have found that recursive queries

Add SQL to every migration creating a field

2016-06-08 Thread TheBeardedTemplar
Hey all, I'll try to be as clear as I can with this problem - basically I am implementing soft-delete functionality in order to allow an 'undo' function that extends quite far into the past. My plan is to do it by creating a subclass of models.Model that looks like this: class

Downsides of calling Model.clean() from Model.save()?

2015-09-11 Thread TheBeardedTemplar
Hey all, I have a model with some fairly strict rules on what is or isn't allowed and I'd like to perform some validation. The model is created via various forms, other functions, and via api calls and so validating the data before the model is created would be quite complicated. Reading on

InterfaceError: connection already closed from psycopg2 when running Django Tests

2015-08-11 Thread TheBeardedTemplar
I'm trying to implement testing on a fairly large Django site, and I'm encountering a psycopg2 error when running all the tests at once using `python manage.py test`. If I specify each app name individually, it works fine (some tests fail, but all for legitimate reasons), however when I run

Re: Moving from Django 1.6 to 1.8 (relation "django_site" does not exist

2015-08-10 Thread TheBeardedTemplar
test database. On Monday, August 10, 2015 at 10:55:13 AM UTC-6, TheBeardedTemplar wrote: > > Hello, > > I'm trying to move a fairly large site from Django 1.6.5 to Django 1.8.3. > I'm also moving from sqlite3 to postgreSQL at the same time and I'm having > trouble with the migra

Moving from Django 1.6 to 1.8 (relation "django_site" does not exist

2015-08-10 Thread TheBeardedTemplar
Hello, I'm trying to move a fairly large site from Django 1.6.5 to Django 1.8.3. I'm also moving from sqlite3 to postgreSQL at the same time and I'm having trouble with the migrations. Here's what I've done so far: - Installed Django 1.8.3, removed south, and installed psycopg 2.6.1 -