this is just a test.
This commit is contained in:
1 parent
59ecff8701
commit
bea6c72759
2 files changed
+14
No files matched your search
@@ -2,6 +2,7 @@ import re
|
||||
|
||||
import magic
|
||||
import math
|
||||
import pathvalidate
|
||||
from django.utils.text import slugify
|
||||
from rest_framework import serializers
|
||||
from rest_framework.fields import SerializerMethodField
|
||||
@@ -211,6 +212,10 @@ class DocumentSerializer(DynamicFieldsModelSerializer):
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_content(self, obj):
|
||||
return pathvalidate.sanitize_filename(obj.content)
|
||||
content = SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = Document
|
||||
depth = 1
|
||||
|
||||
@@ -113,6 +113,15 @@ REST_FRAMEWORK = {
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
'rest_framework.authentication.TokenAuthentication'
|
||||
],
|
||||
'DEFAULT_PARSER_CLASSES': (
|
||||
'rest_framework.parsers.JSONParser',
|
||||
'rest_framework_xml.parsers.XMLParser',
|
||||
),
|
||||
'DEFAULT_RENDERER_CLASSES': (
|
||||
'rest_framework.renderers.JSONRenderer',
|
||||
'rest_framework_xml.renderers.XMLRenderer',
|
||||
'rest_framework.renderers.BrowsableAPIRenderer',
|
||||
),
|
||||
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.AcceptHeaderVersioning',
|
||||
'DEFAULT_VERSION': '1',
|
||||
# Make sure these are ordered and that the most recent version appears
|
||||
|
||||
Reference in new issue
Block a user