Audit   A
last analyzed

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
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
        on_delete=models.CASCADE)
13
    updated_by = models.ForeignKey(
14
        User,
15
        blank=True,
16
        null=True,
17
        related_name='%(class)ss_updators',
18
        on_delete=models.CASCADE)
19
20
    class Meta:
21
        abstract = True
22
23
24
class Person(Audit):
25
26
    """ an actual singular human being """
27
    # model fields
28
    name = models.CharField(blank=True, max_length=100)
29
    email = models.EmailField()
30
    img = models.ImageField(
31
        upload_to='uploads',
32
        blank=True)
33
34
    def __str__(self):
35
        return self.name
36
37
    @property
38
    def foo(self):
39
        return self.name
40
41
42
class PersonEmployment(Audit):
43
44
    mypk = models.AutoField(primary_key=True)
45
    year = models.IntegerField()
46
    salary = models.FloatField()
47
    person = models.ForeignKey(
48
        Person,
49
        blank=True,
50
        null=True,
51
        on_delete=models.CASCADE
52
    )
53
    medical_allowance = models.BooleanField(default=False)
54