Revision b2863bff
fixed a couple errors in the models.py. Then preformed a migration.
crm/robocrm/models.py | ||
---|---|---|
2 | 2 |
from django.contrib.auth.models import User |
3 | 3 |
from django.db.models.signals import post_save |
4 | 4 |
|
5 |
# Machine Model |
|
6 |
class Machine(models.Model): |
|
7 |
type = models.CharField(max_length=20) |
|
8 |
id = models.CharField(max_length=10, primary_key=True) |
|
9 |
maint = models.BooleanField(default=False) |
|
10 |
dstart = models.DateTimeField() |
|
11 |
dend = models.DateTimeField() |
|
5 | 12 |
|
6 | 13 |
# User Model |
7 | 14 |
class RoboUser(models.Model): |
... | ... | |
29 | 36 |
(SOPHOMORE, 'Sophomore'), |
30 | 37 |
(JUNIOR, 'Junior'), |
31 | 38 |
(SENIOR, 'Senior'), |
32 |
(MASTERs, 'Masters'),
|
|
39 |
(MASTERS, 'Masters'),
|
|
33 | 40 |
(DOCTORAL, 'Doctoral'), |
34 | 41 |
) |
35 | 42 |
class_level = models.CharField(max_length=2, |
... | ... | |
42 | 49 |
# Primary and Secondary Major/Minors |
43 | 50 |
major = models.CharField(max_length=20) |
44 | 51 |
sec_major_one = models.CharField(max_length=20) |
45 |
sec_major_two = models.CharField(max_lenght=20)
|
|
52 |
sec_major_two = models.CharField(max_length=20)
|
|
46 | 53 |
|
47 | 54 |
#Club Rank |
48 | 55 |
JUNIOR_MEM = 'JM' |
... | ... | |
87 | 94 |
post_save.connect(create_roboclub_user, sender=User) |
88 | 95 |
|
89 | 96 |
|
90 |
# Machine Model |
|
91 |
class Machine(models.Model) |
|
92 |
type = models.CharField(max_length=20) |
|
93 |
id = models.CharField(max_length=10, unique=True) |
|
94 |
maint = models.BooleanField(default=False) |
|
95 |
dstart = models.DateTimeField() |
|
96 |
dend = models.DateTimeField() |
|
97 |
|
|
98 | 97 |
# Event Model |
99 |
class Event(models.Model) |
|
98 |
class Event(models.Model):
|
|
100 | 99 |
type = models.CharField(max_length=30) |
101 | 100 |
tstart = models.DateTimeField() |
102 | 101 |
tend = models.DateTimeField() |
... | ... | |
108 | 107 |
matuse = models.TextField() |
109 | 108 |
|
110 | 109 |
# Project Model |
111 |
class Project(models.Model) |
|
110 |
class Project(models.Model):
|
|
112 | 111 |
name = models.CharField(max_length=30) |
113 |
primuser = models.Foreignkey('RoboUser')
|
|
114 |
users = models.ManyToManyField('RoboUser') |
|
112 |
primuser = models.ForeignKey('RoboUser', related_name='pri+')
|
|
113 |
users = models.ManyToManyField('RoboUser', related_name='u+')
|
|
115 | 114 |
charge = models.BooleanField(default=False) |
116 | 115 |
|
117 | 116 |
# Roboclub Resources Model |
118 |
class RoboResource |
|
117 |
class RoboResource(models.Model):
|
|
119 | 118 |
type = models.CharField(max_length=30) |
120 |
id = models.CharField(max_length=20, unique=True)
|
|
119 |
id = models.CharField(max_length=20, primary_key=True)
|
|
121 | 120 |
checked_out = models.BooleanField(default=False) |
122 |
user = models.ForeignKey('RoboUser') |
|
121 |
user = models.ForeignKey('RoboUser', related_name='u+')
|
|
123 | 122 |
time_out = models.DateTimeField() |
124 | 123 |
time_due = models.DateTimeField() |
125 |
officer = models.ForeignKey('RoboUser') |
|
124 |
officer = models.ForeignKey('RoboUser', related_name='o+')
|
|
126 | 125 |
|
127 | 126 |
|
Also available in: Unified diff