-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
43 lines (28 loc) · 1009 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import uuid
from django.db import models
from .managers import SoftDeleteManager
class TimeStampedModel(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
class Extensions(models.Model):
""" Best practice for lookup field url instead pk or slug """
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
class UUIDModel(models.Model):
"""
Best practice for lookup field url instead pk or slug.
for security
"""
uuid = models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)
class Meta:
abstract = True
class SoftDeleteModel(models.Model):
is_deleted = models.BooleanField(default=False)
objects = SoftDeleteManager()
class Meta:
abstract = True