Completed
Push — master ( 543ed2...ee1e50 )
by Asif
01:12
created

Person.__unicode__()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 2
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 __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