2016-10-04 17:07:17 +00:00
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from rest_framework import serializers, viewsets
|
|
|
|
from app import models
|
|
|
|
|
|
|
|
class ProjectSerializer(serializers.HyperlinkedModelSerializer):
|
|
|
|
owner = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = models.Project
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
2016-10-04 20:36:08 +00:00
|
|
|
Projects the current user has access to.
|
2016-10-04 17:07:17 +00:00
|
|
|
"""
|
|
|
|
queryset = models.Project.objects.all()
|
|
|
|
serializer_class = ProjectSerializer
|