HiPhone_BE/graph/serializers.py

17 lines
454 B
Python

# from rest_framework import serializers
from rest_framework.serializers import ModelSerializer
from graph.models import Transaction, MonthlyTransaction
class TransactionSerializer(ModelSerializer):
class Meta:
model = Transaction
fields = ("id", "product", "price", "created_at")
class MonthlyTransactionSerializer(ModelSerializer):
class Meta:
model = MonthlyTransaction
fields = ("year", "month", "price")