forked from sjclemen/peten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mayan.diff
50 lines (42 loc) · 1.93 KB
/
mayan.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff -ur mayan/apps/metadata/api_views.py mayan.fixed/apps/metadata/api_views.py
--- mayan/apps/metadata/api_views.py 2016-02-14 20:37:04.000000000 -0500
+++ mayan.fixed/apps/metadata/api_views.py 2016-02-26 20:40:08.938486710 -0500
@@ -97,7 +101,7 @@
def get_queryset(self):
document = self.get_document()
- if self.request == 'GET':
+ if self.request.method == 'GET':
# Make sure the use has the permission to see the metadata for
# this document
try:
@@ -111,7 +115,7 @@
)
else:
return document.metadata.all()
- elif self.request == 'POST':
+ elif self.request.method == 'POST':
# Make sure the use has the permission to add metadata to this
# document
try:
@@ -127,7 +131,7 @@
return document.metadata.all()
def pre_save(self, serializer):
- serializer.document = self.get_document()
+ serializer.documentThing = self.get_document()
def get(self, *args, **kwargs):
"""
diff -ur mayan/apps/metadata/serializers.py /home/mayan-edms/mayan/apps/metadata/serializers.py
--- mayan/apps/metadata/serializers.py 2016-02-14 20:37:04.000000000 -0500
+++ mayan.fixed/apps/metadata/serializers.py 2016-02-26 20:41:07.215775911 -0500
@@ -14,12 +14,15 @@
class DocumentMetadataSerializer(serializers.ModelSerializer):
- document = serializers.PrimaryKeyRelatedField(read_only=True)
+# document = serializers.PrimaryKeyRelatedField(read_only=True, required=False)
class Meta:
fields = ('document', 'id', 'metadata_type', 'value',)
model = DocumentMetadata
+# def create(self, validated_data):
+# validated_data['document'] = self.documentThing
+# return super(DocumentMetadataSerializer, self).create(validated_data)
class DocumentTypeMetadataTypeSerializer(serializers.ModelSerializer):
class Meta: