basicModule.py 753 Bytes
Newer Older
1 2
from django.db import models
from rex.models.tools import UsefullLinksField
3
from rex.models.module import Module
4
from rest_framework import serializers
5 6


7
class BasicModule(Module):
8

9 10
    comment = models.TextField(blank=True)
    usefull_links = UsefullLinksField(blank=True)
11

12 13
    class Meta:
        abstract = True
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28


class BasicModuleSerializer(serializers.ModelSerializer):
    modified_by = serializers.SerializerMethodField()
    modified_date = serializers.SerializerMethodField()

    def get_modified_by(self, obj):
        return obj.modified_by()

    def get_modified_date(self, obj):
        return obj.modified_date()

    class Meta:
        model = BasicModule
        fields = ('comment', 'usefull_links', 'modified_by', 'modified_date')