Files
postgres-web/pgweb/account/models.py
Magnus Hagander 217f9ef62a 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)
2016-05-14 19:49:12 +02:00

22 lines
1.1 KiB
Python

from django.db import models
from django.contrib.auth.models import User
class CommunityAuthSite(models.Model):
name = models.CharField(max_length=100, null=False, blank=False,
help_text="Note that the value in this field is shown on the login page, so make sure it's user-friendly!")
redirecturl = models.URLField(max_length=200, null=False, blank=False)
cryptkey = models.CharField(max_length=100, null=False, blank=False,
help_text="Use tools/communityauth/generate_cryptkey.py to create a key")
comment = models.TextField(null=False, blank=True)
cooloff_hours = models.IntegerField(null=False, blank=False, default=0,
help_text="Number of hours a user must have existed in the systems before allowed to log in to this site")
def __unicode__(self):
return self.name
class EmailChangeToken(models.Model):
user = models.OneToOneField(User, null=False, blank=False)
email = models.EmailField(max_length=75, null=False, blank=False)
token = models.CharField(max_length=100, null=False, blank=False)
sentat = models.DateTimeField(null=False, blank=False, auto_now=True)