Browse Source

Add project admin template

pull/10/head
Hironsan 6 years ago
parent
commit
4e97c54b4d
3 changed files with 64 additions and 1 deletions
  1. 38
      doccano/app/server/templates/project_admin.html
  2. 3
      doccano/app/server/urls.py
  3. 24
      doccano/app/server/views.py

38
doccano/app/server/templates/project_admin.html

@ -0,0 +1,38 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<section class="container" id="root">
<div class="columns">
<div class="column is-12">
<div class="box content">
<article class="post">
<h4>{{ object.name }}</h4>
<div class="media">
<div class="media-left">
<p class="image is-32x32">
<img src="http://bulma.io/images/placeholders/128x128.png">
</p>
</div>
<div class="media-content">
<div class="content">
<p>{{ object.description|truncatechars:200 }}</p>
<p>Data Upload, Label definition</p>
<p>
<a href="#">@jsmith</a> created at {{ object.created_at|date }} &nbsp;
<span class="tag">Question</span>
</p>
</div>
</div>
<div class="media-right">
<span class="has-text-grey-light">
<i class="fa fa-comments"></i> 1</span>
</div>
</div>
</article>
</div>
</div>
</div>
</section>
{% endblock %}

3
doccano/app/server/urls.py

@ -1,11 +1,12 @@
from django.urls import path from django.urls import path
from .views import AnnotationView, AnnotationAPIView, MetaInfoAPI, SearchAPI from .views import AnnotationView, AnnotationAPIView, MetaInfoAPI, SearchAPI
from .views import ProjectListView, ProjectDetailView
from .views import ProjectListView, ProjectDetailView, ProjectAdminView
urlpatterns = [ urlpatterns = [
path('', ProjectListView.as_view(), name='project-list'), path('', ProjectListView.as_view(), name='project-list'),
path('<int:pk>/', ProjectDetailView.as_view(), name='project-detail'), path('<int:pk>/', ProjectDetailView.as_view(), name='project-detail'),
path('<int:pk>/admin', ProjectAdminView.as_view()),
path('<int:project_id>/docs', AnnotationView.as_view()), path('<int:project_id>/docs', AnnotationView.as_view()),
path('<int:project_id>/apis/data', AnnotationAPIView.as_view()), path('<int:project_id>/apis/data', AnnotationAPIView.as_view()),
path('<int:project_id>/apis/label', MetaInfoAPI.as_view()), path('<int:project_id>/apis/label', MetaInfoAPI.as_view()),

24
doccano/app/server/views.py

@ -101,6 +101,20 @@ class LabelAPI(View):
return JsonResponse({'status': 'ok'}) 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): class ProjectListView(ListView):
model = Project model = Project
@ -120,3 +134,13 @@ class ProjectDetailView(DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
return context 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
Loading…
Cancel
Save