From 4e97c54b4d6c608bd2f79a887935d7e3c994d239 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 1 Jun 2018 11:53:33 +0900 Subject: [PATCH] Add project admin template --- .../app/server/templates/project_admin.html | 38 +++++++++++++++++++ doccano/app/server/urls.py | 3 +- doccano/app/server/views.py | 24 ++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 doccano/app/server/templates/project_admin.html diff --git a/doccano/app/server/templates/project_admin.html b/doccano/app/server/templates/project_admin.html new file mode 100644 index 00000000..17ff7dae --- /dev/null +++ b/doccano/app/server/templates/project_admin.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} +{% load static %} +{% block content %} +
+
+ +
+
+
+

{{ object.name }}

+
+
+

+ +

+
+
+
+

{{ object.description|truncatechars:200 }}

+

Data Upload, Label definition

+

+ @jsmith created at {{ object.created_at|date }}   + Question +

+
+
+
+ + 1 +
+
+
+
+
+ +
+
+{% endblock %} \ No newline at end of file diff --git a/doccano/app/server/urls.py b/doccano/app/server/urls.py index ac1e7a27..adecfe82 100644 --- a/doccano/app/server/urls.py +++ b/doccano/app/server/urls.py @@ -1,11 +1,12 @@ from django.urls import path from .views import AnnotationView, AnnotationAPIView, MetaInfoAPI, SearchAPI -from .views import ProjectListView, ProjectDetailView +from .views import ProjectListView, ProjectDetailView, ProjectAdminView urlpatterns = [ path('', ProjectListView.as_view(), name='project-list'), path('/', ProjectDetailView.as_view(), name='project-detail'), + path('/admin', ProjectAdminView.as_view()), path('/docs', AnnotationView.as_view()), path('/apis/data', AnnotationAPIView.as_view()), path('/apis/label', MetaInfoAPI.as_view()), diff --git a/doccano/app/server/views.py b/doccano/app/server/views.py index 3992fc61..0d6f5e12 100644 --- a/doccano/app/server/views.py +++ b/doccano/app/server/views.py @@ -101,6 +101,20 @@ class LabelAPI(View): return JsonResponse({'status': 'ok'}) +class RawDataAPI(View): + + def get(self, request, *args, **kwargs): + """Get raw data.""" + data = [] + return JsonResponse({'data': data}) + + def post(self, request, *args, **kwargs): + """Upload data.""" + print(request.FILES['file']) + # RawData().save() + return JsonResponse({'status': 'ok'}) + + class ProjectListView(ListView): model = Project @@ -120,3 +134,13 @@ class ProjectDetailView(DetailView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) return context + + +class ProjectAdminView(DetailView): + + model = Project + template_name = 'project_admin.html' + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + return context