class UserOfflineScriptExportAccessSerializer(serializers.ModelSerializer): date = DateTimeField(required=False, read_only=True) payed = DateTimeField(required=False, read_only=True) class Meta: model = UserOfflineScriptExportAccess fields = ('id', 'user', 'payed', 'date')
class UserPaymentSerializer(serializers.ModelSerializer): date = DateTimeField(required=False, read_only=True) payed = DateTimeField(required=False, read_only=True) def create(self, validated_data): validated_data['user'] = CustomUser.objects.get(pk=validated_data.get('user')) return UserPayment.objects.create(**validated_data) def update(self, instance, validated_data): return instance class Meta: model = UserPayment fields = ('id', 'name', 'user', 'sum', 'date', 'payed', 'total_sum')
class TableSerializer(serializers.Serializer): id = serializers.CharField(required=True) name = serializers.CharField(required=True) text_coll_name = serializers.CharField(required=True) text_coll_size = serializers.IntegerField(required=True) text_coll_position = serializers.IntegerField(required=True) date = DateTimeField(required=False, read_only=True) date_mod = serializers.DateTimeField(required=True) colls = CollsField() class Meta: fields = ('id', 'name', 'text_coll_name', 'text_coll_size', 'text_coll_position', 'date', 'date_mod', 'colls')
class PaymentLogSerializer(serializers.ModelSerializer): date = DateTimeField(required=False, read_only=True) class Meta: model = PaymentLog fields = ('id', 'name', 'user', 'sum', 'debit_credit', 'date')
class LocalPaymentSerializer(serializers.ModelSerializer): date = DateTimeField(required=False, read_only=True) class Meta: model = LocalPayment fields = ('id', 'name', 'user', 'sum', 'date')