Skip to content

Commit 94756e0

Browse files
committed
Add PersonHistory
- Legacy-Id: 3305
1 parent 38ee292 commit 94756e0

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

redesign/person/models.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
from django.db import models
44
from django.contrib.auth.models import User
55

6-
class Person(models.Model):
6+
class PersonInfo(models.Model):
77
time = models.DateTimeField(auto_now_add=True) # When this Person record entered the system
88
name = models.CharField(max_length=255, db_index=True) # The normal unicode form of the name. This must be
99
# set to the same value as the ascii-form if equal.
1010
ascii = models.CharField(max_length=255) # The normal ascii-form of the name.
1111
ascii_short = models.CharField(max_length=32, null=True, blank=True) # The short ascii-form of the name. Also in alias table if non-null
1212
address = models.TextField(max_length=255, blank=True)
13+
affiliation = models.CharField(max_length=255, blank=True)
1314

14-
user = models.OneToOneField(User, blank=True, null=True)
15-
1615
def __unicode__(self):
1716
return self.name
1817
def _parts(self, name):
@@ -64,12 +63,21 @@ def formatted_email(self):
6463
return e[0].formatted_email()
6564
else:
6665
return ""
67-
def person(self): # little temporary wrapper to help porting
68-
return self
6966
def full_name_as_key(self):
7067
return self.name.lower().replace(" ", ".")
71-
68+
class Meta:
69+
abstract = True
7270

71+
class Person(PersonInfo):
72+
user = models.OneToOneField(User, blank=True, null=True)
73+
74+
def person(self): # little temporary wrapper to help porting to new schema
75+
return self
76+
77+
class PersonHistory(PersonInfo):
78+
person = models.ForeignKey(Person, related_name="history_set")
79+
user = models.ForeignKey(User, blank=True, null=True)
80+
7381
class Alias(models.Model):
7482
"""This is used for alternative forms of a name. This is the
7583
primary lookup point for names, and should always contain the

0 commit comments

Comments
 (0)