Created
April 28, 2018 12:09
-
-
Save CITGuru/9a6f7880969becece40c43588c04721f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import serializers | |
from django.contrib.auth.models import User | |
from tickets.models import Ticket, Category | |
# Serializers define the API representation. | |
class UserSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = User | |
fields = ('id', 'username', 'email', 'is_staff') | |
# Serializers define the API representation. | |
class TicketSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = Ticket | |
fields = ('id','title', 'ticket_id','user', 'status','content', 'category','created', 'modified') | |
# Serializers define the API representation. | |
class CategorySerializer(serializers.ModelSerializer): | |
class Meta: | |
model = Category | |
fields = ('id','name', 'slug') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment