# Path: salarydb/models.py
# class Employee(Model):
#     first_name = CharField(max_length=255)
#     last_name = CharField(max_length=255)
#     position = ForeignKey('Position', blank=True, null=True)
#     faculty = ForeignKey('Faculty', blank=True, null=True)
#     department = ForeignKey('Department', blank=True, null=True)
#     campus = CharField(max_length=255, choices=[('van', 'Vancouver'), ('oka', 'Okanagan')], blank=True, null=True)
#     gender = CharField(max_length=1, choices=[('m', 'Male'), ('f', 'Female')], blank=True, null=True) # 'm' or 'f'
#     remuneration = IntegerField()
#     expenses = IntegerField()
# 
#     slug = CharField(max_length=255)
# 
#     rating = IntegerField(default=0)
#     num_ratings = IntegerField(default=0)
# 
#     class Meta:
#         ordering = ['last_name']
# 
#     def __str__(self):
#         return self.last_name + ', ' + self.first_name
# 
#     def full_name(self):
#         return self.first_name + ' ' + self.last_name
# 
#     def get_rating(self):
#         if self.num_ratings > 0:
#             return float(self.rating) / self.num_ratings
#         else:
#             return False
# 
#     def full_department(self):
#         if self.department and self.faculty:
#             return "%s - %s" % (self.faculty.full_name, self.department.name)
#         elif self.department:
#             return self.department.name
#         else:
#             return self.faculty.full_name
# 
#     def url(self):
#         first_name = self.first_name.split()
#         if len(first_name) > 0:
#             first_name = first_name[0]
#         else:
#             first_name = self.first_name
#         return {
#             'first_name': first_name.lower(),
#             'last_name': self.last_name.lower()
#         }
# 
# class Faculty(Model):
#     full_name = CharField(max_length=255)
#     short_name = CharField(max_length=255)
#     campus = CharField(max_length=255, choices=[('van', 'Vancouver'), ('oka', 'Okanagan')], blank=True, null=True)
# 
#     def __str__(self):
#         return self.full_name
# 
#     class Meta:
#         verbose_name_plural = "faculties"


from salarydb.models import Employee, Faculty
health = Faculty.objects.get(id=10)

for e in employees:
    if e.department:
        if e.department.faculty:
            e.faculty = e.department.faculty
            e.save()
            print e.faculty
        if e.faculty and e.faculty.id == 18: # Creative Studies
            e.faculty = creative_studies
            e.save()
            print "CREATIVE STUDIES"
        elif e.faculty and e.faculty.id == 17: # Health
            e.faculty = health
            e.save()
            print "HEALTH"
        if e.department.name == 'The Sauder School Of Business':
            e.department = None
            e.faculty = sauder
            e.save()
            print "SAUDER"
        elif e.department.name == 'Fac.Of Pharmaceutical Sciences':
            e.department = None
            e.faculty = pharmacy
            e.save()
            print "PHARMACY"
        elif e.department.id == 32:
            e.department = None
            e.faculty = eng_ubco
            e.save()

# Path: salarydb/models.py
# class Employee(Model):
#     first_name = CharField(max_length=255)
#     last_name = CharField(max_length=255)
#     position = ForeignKey('Position', blank=True, null=True)
#     faculty = ForeignKey('Faculty', blank=True, null=True)
#     department = ForeignKey('Department', blank=True, null=True)
#     campus = CharField(max_length=255, choices=[('van', 'Vancouver'), ('oka', 'Okanagan')], blank=True, null=True)
#     gender = CharField(max_length=1, choices=[('m', 'Male'), ('f', 'Female')], blank=True, null=True) # 'm' or 'f'
#     remuneration = IntegerField()
#     expenses = IntegerField()
# 
#     slug = CharField(max_length=255)
# 
#     rating = IntegerField(default=0)
#     num_ratings = IntegerField(default=0)
# 
#     class Meta:
#         ordering = ['last_name']
# 
#     def __str__(self):
#         return self.last_name + ', ' + self.first_name
# 
#     def full_name(self):
#         return self.first_name + ' ' + self.last_name
# 
#     def get_rating(self):
#         if self.num_ratings > 0:
#             return float(self.rating) / self.num_ratings
#         else:
#             return False
# 
#     def full_department(self):
#         if self.department and self.faculty:
#             return "%s - %s" % (self.faculty.full_name, self.department.name)
#         elif self.department:
#             return self.department.name
#         else:
#             return self.faculty.full_name
# 
#     def url(self):
#         first_name = self.first_name.split()
#         if len(first_name) > 0:
#             first_name = first_name[0]
#         else:
#             first_name = self.first_name
#         return {
#             'first_name': first_name.lower(),
#             'last_name': self.last_name.lower()
#         }
# 
# class Faculty(Model):
#     full_name = CharField(max_length=255)
#     short_name = CharField(max_length=255)
#     campus = CharField(max_length=255, choices=[('van', 'Vancouver'), ('oka', 'Okanagan')], blank=True, null=True)
# 
#     def __str__(self):
#         return self.full_name
# 
#     class Meta:
#         verbose_name_plural = "faculties"


# Path: data/assign_faculties.py
from salarydb.models import Employee, Faculty

health = Faculty.objects.get(id=10)

for e in employees:
    if e.department:
        if e.department.faculty:
            e.faculty = e.department.faculty
            e.save()
            print e.faculty
        if e.faculty and e.faculty.id == 18: # Creative Studies
            e.faculty = creative_studies
            e.save()
            print "CREATIVE STUDIES"
        elif e.faculty and e.faculty.id == 17: # Health
            e.faculty = health
            e.save()
            print "HEALTH"
        if e.department.name == 'The Sauder School Of Business':
            e.department = None
            e.faculty = sauder
            e.save()
            print "SAUDER"
        elif e.department.name == 'Fac.Of Pharmaceutical Sciences':
            e.department = None
            e.faculty = pharmacy
            e.save()
            print "PHARMACY"
        elif e.department.id == 32:
            e.department = None
            e.faculty = eng_ubco
            e.save()

        elif e.department.name == 'Faculty Of Law':