Compare commits
27 commits
a08428c90b
...
9badf494a6
Author | SHA1 | Date | |
---|---|---|---|
Cayo Puigdefabregas | 9badf494a6 | ||
Cayo Puigdefabregas | d98e8e2d48 | ||
Cayo Puigdefabregas | c60a9dd89d | ||
4cf164d4bc | |||
9f05dee6a7 | |||
1d9d100fae | |||
096b83da81 | |||
d995db8181 | |||
3d2cb7d184 | |||
Cayo Puigdefabregas | b7c4926c39 | ||
Cayo Puigdefabregas | e6141bcc7f | ||
Cayo Puigdefabregas | 0b55d34d74 | ||
c49644ffbd | |||
425b032273 | |||
bf47d4bc5d | |||
67869bc6f5 | |||
f757c58356 | |||
0e8607d93e | |||
3d10217599 | |||
Cayo Puigdefabregas | d8b6d3ded6 | ||
Cayo Puigdefabregas | c422eaddeb | ||
Cayo Puigdefabregas | 090ecc275f | ||
Cayo Puigdefabregas | 2f9b61667d | ||
Cayo Puigdefabregas | 003d224c3e | ||
Cayo Puigdefabregas | fae269eb8d | ||
Cayo Puigdefabregas | 69a54b92fb | ||
d04216ad79 |
15
api/views.py
15
api/views.py
|
@ -2,15 +2,12 @@ import json
|
|||
|
||||
from uuid import uuid4
|
||||
|
||||
from django.conf import settings
|
||||
from django.urls import reverse_lazy
|
||||
from django.http import JsonResponse
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.core.exceptions import ValidationError
|
||||
from django_tables2 import SingleTableView
|
||||
from django.views.generic.base import View
|
||||
from django.views.generic.edit import (
|
||||
CreateView,
|
||||
DeleteView,
|
||||
|
@ -21,7 +18,6 @@ from utils.save_snapshots import move_json, save_in_disk
|
|||
from dashboard.mixins import DashboardView
|
||||
from evidence.models import Annotation
|
||||
from evidence.parse import Build
|
||||
from user.models import User
|
||||
from api.models import Token
|
||||
from api.tables import TokensTable
|
||||
|
||||
|
@ -79,17 +75,16 @@ def NewSnapshot(request):
|
|||
|
||||
|
||||
if not annotation:
|
||||
return JsonResponse({'status': 'fail'}, status=200)
|
||||
return JsonResponse({'status': 'fail'}, status=500)
|
||||
|
||||
url_args = reverse_lazy("device:details", args=(annotation.value,))
|
||||
url = request.build_absolute_uri(url_args)
|
||||
|
||||
url = "{}://{}{}".format(
|
||||
request.scheme,
|
||||
settings.DOMAIN,
|
||||
reverse_lazy("device:details", args=(annotation.value,))
|
||||
)
|
||||
response = {
|
||||
"status": "success",
|
||||
"dhid": annotation.value[:6].upper(),
|
||||
"url": url,
|
||||
# TODO replace with public_url when available
|
||||
"public_url": url
|
||||
}
|
||||
move_json(path_name, tk.owner.institution.name)
|
||||
|
|
Loading…
Reference in a new issue