Added linting and got tests passing
This commit is contained in:
@@ -477,7 +477,7 @@ class WorkAddDocumentView(CollectionMixin, CreateView):
|
||||
doc.sections.create(tag=inst.abbreviate())
|
||||
|
||||
if self.request.headers["Accept"] == "application/json":
|
||||
filename = os.path.basename(doc.upload.name)
|
||||
os.path.basename(doc.upload.name)
|
||||
return JsonResponse(
|
||||
{
|
||||
"message": "created",
|
||||
@@ -541,7 +541,7 @@ class DocumentAnnotateView(DocumentMixin, DetailView):
|
||||
for tag, start, end in data:
|
||||
# pages.sort()
|
||||
# end = pages[-1] if len(pages) > 1 else None
|
||||
o = self.object.sections.create(tag=tag, start=start, end=end)
|
||||
self.object.sections.create(tag=tag, start=start, end=end)
|
||||
|
||||
return HttpResponse(status=204)
|
||||
|
||||
|
||||
+17
-19
@@ -1,3 +1,20 @@
|
||||
from interface.views import AuthorizedResourceMixin
|
||||
|
||||
from rest_framework import serializers
|
||||
from rest_framework.exceptions import APIException
|
||||
from rest_framework import generics
|
||||
|
||||
from library.models import Collection, Work, Document, Section, WorkMeta
|
||||
|
||||
|
||||
import requests
|
||||
import urllib
|
||||
import shutil
|
||||
import os.path
|
||||
|
||||
from django.db import transaction
|
||||
from django.core.files.uploadedfile import TemporaryUploadedFile
|
||||
|
||||
"""
|
||||
Views relating to importing and exporting collection items
|
||||
"""
|
||||
@@ -33,22 +50,6 @@ class WorkExportView(EnsembleMixin, WorkMixin, View):
|
||||
|
||||
"""
|
||||
|
||||
from interface.views import AuthorizedResourceMixin
|
||||
|
||||
from rest_framework import serializers
|
||||
from rest_framework.exceptions import APIException
|
||||
|
||||
from library.models import Collection, Work, Document, Section, WorkMeta
|
||||
|
||||
|
||||
import requests
|
||||
import urllib
|
||||
import shutil
|
||||
import os.path
|
||||
|
||||
from django.db import transaction
|
||||
from django.core.files.uploadedfile import TemporaryUploadedFile
|
||||
|
||||
|
||||
class WorkMetaSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
@@ -176,9 +177,6 @@ class CollectionSerializer(serializers.Serializer):
|
||||
return Collection.objects.get(pk=collection)
|
||||
|
||||
|
||||
from rest_framework import generics
|
||||
|
||||
|
||||
class CollectionExportView(AuthorizedResourceMixin, generics.RetrieveAPIView):
|
||||
serializer_class = CollectionSerializer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user