|
3 | 3 | from django.db import models |
4 | 4 | from django.contrib.auth.models import User |
5 | 5 |
|
6 | | -class Person(models.Model): |
| 6 | +class PersonInfo(models.Model): |
7 | 7 | time = models.DateTimeField(auto_now_add=True) # When this Person record entered the system |
8 | 8 | name = models.CharField(max_length=255, db_index=True) # The normal unicode form of the name. This must be |
9 | 9 | # set to the same value as the ascii-form if equal. |
10 | 10 | ascii = models.CharField(max_length=255) # The normal ascii-form of the name. |
11 | 11 | 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 |
12 | 12 | address = models.TextField(max_length=255, blank=True) |
| 13 | + affiliation = models.CharField(max_length=255, blank=True) |
13 | 14 |
|
14 | | - user = models.OneToOneField(User, blank=True, null=True) |
15 | | - |
16 | 15 | def __unicode__(self): |
17 | 16 | return self.name |
18 | 17 | def _parts(self, name): |
@@ -64,12 +63,21 @@ def formatted_email(self): |
64 | 63 | return e[0].formatted_email() |
65 | 64 | else: |
66 | 65 | return "" |
67 | | - def person(self): # little temporary wrapper to help porting |
68 | | - return self |
69 | 66 | def full_name_as_key(self): |
70 | 67 | return self.name.lower().replace(" ", ".") |
71 | | - |
| 68 | + class Meta: |
| 69 | + abstract = True |
72 | 70 |
|
| 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 | + |
73 | 81 | class Alias(models.Model): |
74 | 82 | """This is used for alternative forms of a name. This is the |
75 | 83 | primary lookup point for names, and should always contain the |
|
0 commit comments