|
|
@ -201,17 +201,6 @@ class ProjectPolymorphicSerializer(PolymorphicSerializer): |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class ProjectFilteredPrimaryKeyRelatedField(serializers.PrimaryKeyRelatedField): |
|
|
|
|
|
|
|
def get_queryset(self): |
|
|
|
view = self.context.get('view', None) |
|
|
|
request = self.context.get('request', None) |
|
|
|
queryset = super(ProjectFilteredPrimaryKeyRelatedField, self).get_queryset() |
|
|
|
if not request or not queryset or not view: |
|
|
|
return None |
|
|
|
return queryset.filter(project=view.kwargs['project_id']) |
|
|
|
|
|
|
|
|
|
|
|
class CategorySerializer(serializers.ModelSerializer): |
|
|
|
label = serializers.PrimaryKeyRelatedField(queryset=Label.objects.all()) |
|
|
|
example = serializers.PrimaryKeyRelatedField(queryset=Example.objects.all()) |
|
|
|