Get rid of PgModel, replacing it with simple signals

We were already using signals for everything except delete, and even
in our old version of django the delete signal exists (it didn't exist
when this code was first written).

Django doesn't really like models to be OOP like this, so keeping PgModel
would cause issues with upcoming changes in django 1.8. Using simple functions
is easier, and the actual functionality is replicated straight off.
This commit is contained in:
Magnus Hagander
2016-03-07 21:41:45 +01:00
parent d15fc715af
commit 8058accee0
19 changed files with 172 additions and 231 deletions

View File

@ -1,6 +1,5 @@
from django.db import models
from django.contrib.auth.models import User
from pgweb.util.bases import PgModel
from pgweb.util.misc import varnish_purge
from datetime import datetime
@ -13,7 +12,7 @@ TESTING_CHOICES = (
)
TESTING_SHORTSTRING = ('', 'rc', 'beta', 'alpha')
class Version(PgModel, models.Model):
class Version(models.Model):
tree = models.DecimalField(max_digits=3, decimal_places=1, null=False, blank=False, unique=True)
latestminor = models.IntegerField(null=False, blank=False, default=0, help_text="For testing versions, latestminor means latest beta/rc number. For other releases, it's the latest minor release number in the tree.")
reldate = models.DateField(null=False, blank=False)
@ -113,7 +112,7 @@ class OrganisationType(models.Model):
def __unicode__(self):
return self.typename
class Organisation(PgModel, models.Model):
class Organisation(models.Model):
name = models.CharField(max_length=100, null=False, blank=False, unique=True)
approved = models.BooleanField(null=False, default=False)
address = models.TextField(null=False, blank=True)