Otherwise, you could have a situation the REST API returns an
empty string for a GET request, but JSONField complains when the
same empty string is passed as a PUT request.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
api/migrations/0033_auto_20180803_0809.py | 22 ++++++++++++++++++++++
api/models.py | 2 +-
2 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 api/migrations/0033_auto_20180803_0809.py
diff --git a/api/migrations/0033_auto_20180803_0809.py b/api/migrations/0033_auto_20180803_0809.py
new file mode 100644
index 0000000..12753cd
--- /dev/null
+++ b/api/migrations/0033_auto_20180803_0809.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.13 on 2018-08-03 08:09
+from __future__ import unicode_literals
+
+from django.db import migrations
+import jsonfield.encoder
+import jsonfield.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0032_fix_git_results'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='result',
+ name='data',
+ field=jsonfield.fields.JSONField(default={}, dump_kwargs={'cls': jsonfield.encoder.JSONEncoder, 'separators': (',', ':')}, load_kwargs={}),
+ ),
+ ]
diff --git a/api/models.py b/api/models.py
index ad89cf8..eea924f 100644
--- a/api/models.py
+++ b/api/models.py
@@ -56,7 +56,7 @@ class Result(models.Model):
code='invalid')])
log_entry = models.OneToOneField(LogEntry, on_delete=models.CASCADE,
null=True)
- data = jsonfield.JSONField()
+ data = jsonfield.JSONField(default={})
class Meta:
index_together = [('status', 'name')]
--
2.17.1
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel