mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 10:12:35 -04:00 
			
		
		
		
	Merge pull request #202 from danielquinn/fix/api-should-allow-writes
Fix/api should allow writes
This commit is contained in:
		
						commit
						0f7bfc547a
					
				| @ -1,6 +1,10 @@ | ||||
| Changelog | ||||
| ######### | ||||
| 
 | ||||
| * 0.3.6 | ||||
|   * Fix for `#200`_ (!!) where the API wasn't configured to allow updating the | ||||
|     correspondent or the tags for a document. | ||||
| 
 | ||||
| * 0.3.5 | ||||
|   * A serious facelift for the documents listing page wherein we drop the | ||||
|     tabular layout in favour of a tiled interface. | ||||
| @ -187,3 +191,4 @@ Changelog | ||||
| .. _#171: https://github.com/danielquinn/paperless/issues/171 | ||||
| .. _#172: https://github.com/danielquinn/paperless/issues/172 | ||||
| .. _#179: https://github.com/danielquinn/paperless/pull/179 | ||||
| .. _#200: https://github.com/danielquinn/paperless/issues/200 | ||||
|  | ||||
| @ -18,12 +18,21 @@ class TagSerializer(serializers.HyperlinkedModelSerializer): | ||||
|             "id", "slug", "name", "colour", "match", "matching_algorithm") | ||||
| 
 | ||||
| 
 | ||||
| class CorrespondentField(serializers.HyperlinkedRelatedField): | ||||
|     def get_queryset(self): | ||||
|         return Correspondent.objects.all() | ||||
| 
 | ||||
| 
 | ||||
| class TagsField(serializers.HyperlinkedRelatedField): | ||||
|     def get_queryset(self): | ||||
|         return Tag.objects.all() | ||||
| 
 | ||||
| 
 | ||||
| class DocumentSerializer(serializers.ModelSerializer): | ||||
| 
 | ||||
|     correspondent = serializers.HyperlinkedRelatedField( | ||||
|         read_only=True, view_name="drf:correspondent-detail", allow_null=True) | ||||
|     tags = serializers.HyperlinkedRelatedField( | ||||
|         read_only=True, view_name="drf:tag-detail", many=True) | ||||
|     correspondent = CorrespondentField( | ||||
|         view_name="drf:correspondent-detail", allow_null=True) | ||||
|     tags = TagsField(view_name="drf:tag-detail", many=True) | ||||
| 
 | ||||
|     class Meta(object): | ||||
|         model = Document | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user