22 lines
637 B
Python
22 lines
637 B
Python
|
"""Expression Policy API"""
|
||
|
from rest_framework.serializers import ModelSerializer
|
||
|
from rest_framework.viewsets import ModelViewSet
|
||
|
|
||
|
from passbook.policies.expression.models import ExpressionPolicy
|
||
|
from passbook.policies.forms import GENERAL_SERIALIZER_FIELDS
|
||
|
|
||
|
|
||
|
class ExpressionPolicySerializer(ModelSerializer):
|
||
|
"""Group Membership Policy Serializer"""
|
||
|
|
||
|
class Meta:
|
||
|
model = ExpressionPolicy
|
||
|
fields = GENERAL_SERIALIZER_FIELDS + ["expression"]
|
||
|
|
||
|
|
||
|
class ExpressionPolicyViewSet(ModelViewSet):
|
||
|
"""Source Viewset"""
|
||
|
|
||
|
queryset = ExpressionPolicy.objects.all()
|
||
|
serializer_class = ExpressionPolicySerializer
|