Skip to content

Commit

Permalink
Merge pull request #41 from dhmit/corpus_model_bugs
Browse files Browse the repository at this point in the history
Fixed Corpus model bugs
  • Loading branch information
phuang00 authored Jul 15, 2021
2 parents 54d8bed + 5df8d69 commit b023da2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions backend/app/migrations/0008_auto_20210712_1847.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2021-07-12 18:47

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('app', '0007_corpus'),
]

operations = [
migrations.AlterField(
model_name='corpus',
name='documents',
field=models.ManyToManyField(blank=True, to='app.Document'),
),
]
2 changes: 1 addition & 1 deletion backend/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ class Corpus(models.Model):
"""
title = models.CharField(max_length=30)
description = models.CharField(max_length=500, blank=True)
documents = models.ManyToManyField(Document)
documents = models.ManyToManyField(Document, blank=True)

class Meta:
verbose_name_plural = "Corpora"
Expand Down
3 changes: 2 additions & 1 deletion backend/app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ class Meta:
model = Document
fields = ['id', 'author', 'title', 'year', 'word_count']


class CorpusSerializer(serializers.ModelSerializer):
"""
Serializes a Corpus object
"""

class Meta:
model = Corpus
fields = ['id', 'title', 'description']
fields = ['id', 'title', 'description', 'documents']

0 comments on commit b023da2

Please sign in to comment.