diff --git a/openlobby/core/documents.py b/openlobby/core/documents.py index 4d4b339914cf7c1fc3e0d664f10fb0b9be18179c..69504a988e15884cf7774c618cc16cd41a597fe5 100644 --- a/openlobby/core/documents.py +++ b/openlobby/core/documents.py @@ -33,4 +33,5 @@ class ReportDoc(DocType): fields = [ 'date', 'published', + 'is_draft', ] diff --git a/openlobby/core/migrations/0011_report_is_draft.py b/openlobby/core/migrations/0011_report_is_draft.py new file mode 100644 index 0000000000000000000000000000000000000000..f5a7d1865998efdb4c5a051196217a7b6acd6aed --- /dev/null +++ b/openlobby/core/migrations/0011_report_is_draft.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.2 on 2018-02-25 22:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0010_user_has_colliding_name'), + ] + + operations = [ + migrations.AddField( + model_name='report', + name='is_draft', + field=models.BooleanField(default=False), + ), + ] diff --git a/openlobby/core/models.py b/openlobby/core/models.py index 0860348fe2cff13be8430b3c0f71eef7ead27c8d..36dca0383b93df41f626de9c39aa267f251c01f7 100644 --- a/openlobby/core/models.py +++ b/openlobby/core/models.py @@ -64,6 +64,7 @@ class Report(models.Model): our_participants = models.TextField(null=True, blank=True) other_participants = models.TextField(null=True, blank=True) extra = JSONField(null=True, blank=True) + is_draft = models.BooleanField(default=False) def save(self, *args, **kwargs): super().save(*args, **kwargs) diff --git a/tests/test_models.py b/tests/test_models.py index 8988d6e97eecc723e106613874458dcc3462e650..bccd5d0d178729bcd9a38f5324d4414f9d62b368 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -34,6 +34,7 @@ def test_report__is_saved_in_elasticsearch(): our_participants='me', other_participants='them', extra={'a': 3}, + is_draft=False, ) docs = list(ReportDoc.search()) assert len(docs) == 1 @@ -49,6 +50,7 @@ def test_report__is_saved_in_elasticsearch(): assert doc.our_participants == 'me' assert doc.other_participants == 'them' assert doc.extra == {'a': 3} + assert doc.is_draft is False def test_report__save_works_with_no_extra():