myModel.py 1.04 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
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
from django.db import models
from django.contrib.auth.models import User
from rest_framework import serializers
# from backend.signals import new_revision_saved
# import reversion
from django.utils import timezone
from backend.models.tools import PendingModeration
from django.conf import settings
from django.contrib.contenttypes.models import ContentType


class MyModel(models.Model):
    """
        All models in the app deppend of this one.
        It contains the required attributes for managing eventual moderation data.

        All the logic behind moderation is done in myModelSerializer
    """

    moderated_by = models.ForeignKey(
        User, null=True, on_delete=models.SET_NULL, related_name='moderated')
    moderated_on = models.DateTimeField(null=True)

    updated_on = models.DateTimeField(null=True)
    updated_by = models.ForeignKey(
        User, null=True, on_delete=models.SET_NULL, related_name='updated')

    class Meta:
        abstract = True


# class MyModelVersionned(MyModel):
#     class Meta:
#         abstract = True