Completed
Push — master ( 0e1b0c...a17d09 )
by Asif
28s
created

Person.foo()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
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 __str__(self):
33
        return self.name
34
35
    @property
36
    def foo(self):
37
        return self.name
38
39
40
class PersonEmployment(Audit):
41
42
    mypk = models.AutoField(primary_key=True)
43
    year = models.IntegerField()
44
    salary = models.FloatField()
45
    person = models.ForeignKey(
46
        Person,
47
        blank=True,
48
        null=True,
49
    )
50
    medical_allowance = models.BooleanField(default=False)
51