Fix model warnings and deprecations

1. ForeignKey with unique -> OneToOneField
2. IPAddressField -> GenericIPAddressField
3. Fix fields with default=datetime.now() which gives server start time,
   not the insert time (clearly this default was never used, and the
   field was always explicitly set, but it should still not be incorrectly
   defined)
This commit is contained in:
Magnus Hagander
2016-04-28 13:22:53 +02:00
parent 0e2a47cf25
commit 217f9ef62a
6 changed files with 12 additions and 18 deletions

View File

@ -5,7 +5,7 @@ from pgweb.core.models import Organisation
class ProfessionalService(models.Model):
approved = models.BooleanField(null=False, blank=False, default=False)
org = models.ForeignKey(Organisation, null=False, blank=False, unique=True,
org = models.OneToOneField(Organisation, null=False, blank=False,
db_column="organisation_id",
verbose_name="organisation",
help_text="If no organisations are listed, please check the <a href=\"/account/orglist/\">organisation list</a> and contact the organisation manager or webmaster@postgresql.org if none are listed.")