2017-03-22 16:15:25 +00:00
|
|
|
# ~*~ coding: utf-8 ~*~
|
|
|
|
from __future__ import unicode_literals
|
2022-11-11 11:20:17 +00:00
|
|
|
|
2017-03-22 16:15:25 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
2022-11-11 11:20:17 +00:00
|
|
|
from common.drf.fields import ReadableHiddenField
|
2022-12-15 09:25:21 +00:00
|
|
|
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
2022-11-29 11:44:12 +00:00
|
|
|
from ..models import AdHoc
|
2017-03-22 16:15:25 +00:00
|
|
|
|
|
|
|
|
2022-12-15 09:25:21 +00:00
|
|
|
class AdHocSerializer(BulkOrgResourceModelSerializer):
|
2022-11-29 11:44:12 +00:00
|
|
|
creator = ReadableHiddenField(default=serializers.CurrentUserDefault())
|
2022-11-11 11:20:17 +00:00
|
|
|
row_count = serializers.IntegerField(read_only=True)
|
|
|
|
size = serializers.IntegerField(read_only=True)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = AdHoc
|
2022-11-30 08:24:17 +00:00
|
|
|
read_only_field = ["id", "row_count", "size", "creator", "date_created", "date_updated"]
|
|
|
|
fields = read_only_field + ["id", "name", "module", "args", "comment"]
|