Browse Source

Update models

pull/10/head
Hironsan 6 years ago
parent
commit
3c9567d235
3 changed files with 18 additions and 6 deletions
  1. BIN
      doccano/app/db.sqlite3
  2. 3
      doccano/app/server/admin.py
  3. 21
      doccano/app/server/models.py

BIN
doccano/app/db.sqlite3

3
doccano/app/server/admin.py

@ -1,6 +1,7 @@
from django.contrib import admin
from .models import Annotation, Label
from .models import Annotation, Label, RawData
admin.site.register(Annotation)
admin.site.register(Label)
admin.site.register(RawData)

21
doccano/app/server/models.py

@ -5,17 +5,28 @@ class Label(models.Model):
text = models.CharField(max_length=100)
def as_dict(self):
return {'id': self.id, 'text': self.text}
return {'id': self.id,
'text': self.text}
class Annotation(models.Model):
class RawData(models.Model):
text = models.TextField()
def as_dict(self):
return {'id': self.id,
'text': self.text}
class Annotation(models.Model):
prob = models.FloatField(blank=True, null=True)
labels = models.ManyToManyField(Label, blank=True, null=True)
# users = models.ManyToManyField(User)
label = models.ForeignKey(Label, on_delete=models.CASCADE)
data = models.ForeignKey(RawData, on_delete=models.CASCADE)
def as_dict(self):
return {'id': self.id, 'text': self.text, 'prob': self.prob}
return {'id': self.id,
'data_id': self.data.id,
'label_id': self.label.id,
'prob': self.prob}
class User(models.Model):

Loading…
Cancel
Save