diff --git a/backend/webapp/prototype/filehandler/functions.py b/backend/webapp/prototype/filehandler/functions.py index 778bb3f..e9c3676 100644 --- a/backend/webapp/prototype/filehandler/functions.py +++ b/backend/webapp/prototype/filehandler/functions.py @@ -34,7 +34,7 @@ def createLabels(data): def updateLabelsByParagraphId(data): for paragraph_ in data: - Paragraph.objects.filter(pk = paragraph_['id']).update(label = paragraph_['label']) + Paragraph.objects.filter(pk = paragraph_['id']).update(label = paragraph_['label'], user_updated = True) return(True) def addToDatabase(data, file_id): @@ -85,14 +85,17 @@ def listParagraphsFromDiscussion(id): message = [] para_id = [] label = [] + user_updated = [] paragraphs = Paragraph.objects.filter(post_id = elem.pk) for paragraph in paragraphs: message.append(paragraph.message) para_id.append(paragraph.pk) label.append(paragraph.label) + user_updated.append(paragraph.user_updated) obj['message'] = message obj['para_id'] = para_id obj['label'] = label + obj['user_updated'] = user_updated posts_.append(obj) out['posts'] = posts_ return(out) diff --git a/backend/webapp/prototype/filehandler/models.py b/backend/webapp/prototype/filehandler/models.py index a7dc1a0..de8059f 100644 --- a/backend/webapp/prototype/filehandler/models.py +++ b/backend/webapp/prototype/filehandler/models.py @@ -25,4 +25,5 @@ class Post(models.Model): class Paragraph(models.Model): message = models.TextField() label = models.CharField(max_length=255) + user_updated = models.BooleanField(default=False) post = models.ForeignKey(Post, on_delete=models.CASCADE)