示例#1
0
 def allowed_access(self, request, *args, **kwargs):
     instance = self.get_object()
     qs = instance.allowed_access.all()
     serializer = AccessTypeSerializer(qs,
                                       context={'request': request},
                                       many=True)
     #serializer = ActivitySerializer(qs)
     return Response(serializer.data)
示例#2
0
class VehicleSerializer(serializers.ModelSerializer):
    access_type = AccessTypeSerializer()
    rego_expiry = serializers.DateField(format="%d/%m/%Y")

    class Meta:
        model = Vehicle
        fields = ('id', 'capacity', 'rego', 'license', 'access_type',
                  'rego_expiry', 'proposal')
示例#3
0
class ProposalParkAccessSerializer(serializers.ModelSerializer):
    access_type=AccessTypeSerializer()
    class Meta:
        model = ProposalParkAccess
        fields = '__all__'