Completed
Push — master ( 21b94f...0c3366 )
by Asif
01:28
created

Person   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 8
Bugs 2 Features 1
Metric Value
wmc 2
c 8
b 2
f 1
dl 0
loc 16
rs 10
1
from django.db import models
2
from django.contrib.auth.models import User
3
4
5
class Audit(models.Model):
6
    created_at = models.DateTimeField(auto_now=True)
7
    created_by = models.ForeignKey(
8
        User,
9
        blank=True,
10
        null=True,
11
        related_name='%(class)ss_creators')
12
    updated_by = models.ForeignKey(
13
        User,
14
        blank=True,
15
        null=True,
16
        related_name='%(class)ss_updators')
17
18
    class Meta:
19
        abstract = True
20
21
22
class Person(Audit):
23
24
    """ an actual singular human being """
25
    # model fields
26
    name = models.CharField(blank=True, max_length=100)
27
    email = models.EmailField()
28
    img = models.ImageField(
29
        upload_to='uploads',
30
        blank=True)
31
32
    def __unicode__(self):
33
        return self.name
34
35
    @property
36
    def foo(self):
37
        return self.name
38
39
40
class PersonEmployment(Audit):
41
    year = models.IntegerField()
42
    salary = models.FloatField()
43
    person = models.ForeignKey(
44
        Person,
45
        blank=True,
46
        null=True,
47
    )
48
    medical_allowance = models.BooleanField(default=False)
49