From 75674126b674f98818109d15072893a7d11a66fa Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 11 Jun 2018 11:10:36 +0900 Subject: [PATCH] Add foreignkey to label and data --- doccano/app/db.sqlite3 | Bin 184320 -> 184320 bytes doccano/app/server/models.py | 24 +++++++++++++----------- doccano/app/server/static/annotation.js | 15 ++++++--------- doccano/app/server/views.py | 18 ++++++++++++------ 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/doccano/app/db.sqlite3 b/doccano/app/db.sqlite3 index d4327b4b3f5107779d1dd5890c50a6b43558bf1d..399e96ee3c42f8d2532d4702b9ee1d32c8c5ac0f 100644 GIT binary patch delta 4012 zcmeHKdu&tJ8NcUVKXU#0LJ64CJe)v)6yn^6?<FE_n1%atGKY z@@sOjUR18aI2~+sJUm#xG?}#)JO7MEV}u zli^e>l1>vzxy{N{u=&Lv0)xZwTgprbifv5wi1nyH5RRH3g4_NiQ;F_yFvB14}@SD z%!TI%$E~k|+}wG;oMeGH6kLJd!Ta!YcnNku27=H6bBIPIDCi&>ZIJ7Dsd}KXbIGdZKCLAZ?n_T?=vOmJSGVewdp0g#`*`DunGK7z zWOuB)Rc#b{RzIOgvCV<#f^=YIdd`^8Q0qC~EpwtQdAcI0L_F<}kI_)-CC;r1oFIz& z_7GgB;5toNh%cAGZe_~Y5ukk#CBLe8A!%UBp(STNN&M$*kZU>r6BAWTa{MNNT!q~& zM#e~62GRPjDt?$OChs374aL|nA9>BzArnP0Qx7klkKU}PBi8K9ixl%Bta2Q+->}!( zj8@*Vqv%}Ge)F5Aq;VVFgnowHj*HYz$2lspd-r2AiwK5t9HovpH4SZrj6VROwOL9tl;|5X35{uNq}*Bk@pp zbAc@%N$rK`A$skyUk$0D4sNu3I^OsOJz?OUx>c^`CRf#Hgl_pZX;n>jT)o-3tOjMJ z(Z&lwINH3*1!PjD!~$7CW7@*yi@dn!4SHO~eK5KkID3FDnRth3mu7aZkx_W}>z4d4k{veEs@zqypkF{p&0*~1#Nof0YJa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W_T&)FfvRG(*cSakE`;&Zbwd=7I#@W(B~wf zCl|zhK}SxT#&uaaVgd%es;sD^0gyAuY@lVZ+9buE{HTM}ve~b~!I)H36G=%L^*d5p z#-z(ifs^^-2~|*)(Jn_y%g}RqDNtLJsw7LJosN{25$3W|Wa!i7IJ7pSK1WK+KyrC0 zkRupy#g$R7Bc)}$xV#iGCPHDyh0zX2O3SctSt-mcL z^M7CXs)xLfJP^JH7x;$+kN^@u0!RP}AOR$R1dsp{KmthM{}X{pjm~7*o7|Q)i<^Cu z3ojyIl` 0 if once_active_learned: # Use Annotation model & RawData model. @@ -28,9 +30,12 @@ class AnnotationAPIView(View): docs = Annotation.objects.all() else: # Left outer join data and annotation. - docs = RawData.objects.filter(annotation__isnull=True) + docs = RawData.objects.filter(annotation__isnull=True, project=project) docs = [{**d.as_dict(), **{'labels': []}} for d in docs] + if not docs: + docs = [{'id': None, 'labels': [], 'text': ''}] + return JsonResponse({'data': docs}) def post(self, request, *args, **kwargs): @@ -54,12 +59,10 @@ class AnnotationAPIView(View): class MetaInfoAPI(View): def get(self, request, *args, **kwargs): - labels = Label.objects.all() - labels = [l.as_dict() for l in labels] total = RawData.objects.count() remaining = RawData.objects.filter(annotation__isnull=True).count() - return JsonResponse({'labels': labels, 'total': total, 'remaining': remaining}) + return JsonResponse({'total': total, 'remaining': remaining}) class SearchAPI(View): @@ -80,7 +83,8 @@ class LabelAPI(View): def get(self, request, *args, **kwargs): """Get labels.""" - labels = Label.objects.all() + project_id = kwargs.get('pk') + labels = Label.objects.filter(project=project_id) labels = [label.as_dict() for label in labels] return JsonResponse({'labels': labels}) @@ -89,11 +93,13 @@ class LabelAPI(View): """Create labels.""" #text = request.POST.get('text') #shortcut = request.POST.get('shortcut') + project_id = kwargs.get('pk') + project = Project.objects.get(id=project_id) body = request.body.decode('utf-8').replace("'", '"') body = json.loads(body) text = body.get('text') shortcut = body.get('shortcut') - label = Label(text=text, shortcut=shortcut) + label = Label(text=text, shortcut=shortcut, project=project) label.save() return JsonResponse(label.as_dict())