From 16f0a963be7acd81d5301cf3791de1255a5be95b Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 1 Jun 2017 21:32:27 -0500 Subject: [PATCH] Allow even more null fields --- core/migrations/0005_auto_20170602_0231.py | 36 ++++++++++++++++++++++ core/models.py | 8 ++--- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 core/migrations/0005_auto_20170602_0231.py diff --git a/core/migrations/0005_auto_20170602_0231.py b/core/migrations/0005_auto_20170602_0231.py new file mode 100644 index 0000000..275cdae --- /dev/null +++ b/core/migrations/0005_auto_20170602_0231.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-06-02 02:31 +from __future__ import unicode_literals + +import django.contrib.postgres.fields.jsonb +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0004_auto_20170602_0146'), + ] + + operations = [ + migrations.AlterField( + model_name='api_apps', + name='callback_uri', + field=models.URLField(blank=True, max_length=3000), + ), + migrations.AlterField( + model_name='api_apps', + name='settings', + field=django.contrib.postgres.fields.jsonb.JSONField(blank=True), + ), + migrations.AlterField( + model_name='api_apps', + name='website', + field=models.URLField(blank=True, max_length=3000), + ), + migrations.AlterField( + model_name='api_heartbeat', + name='data', + field=django.contrib.postgres.fields.jsonb.JSONField(blank=True), + ), + ] diff --git a/core/models.py b/core/models.py index 2fecd9c..882df86 100644 --- a/core/models.py +++ b/core/models.py @@ -26,9 +26,9 @@ class api_apps(models.Model): apikey = models.CharField(max_length=256, unique=True, blank=False) name = models.CharField(max_length=512, unique=True, blank=False) description = models.CharField(max_length=2048) - website = models.URLField(max_length=3000) - callback_uri = models.URLField(max_length=3000) - settings = JSONField() + website = models.URLField(max_length=3000, blank=True) + callback_uri = models.URLField(max_length=3000, blank=True) + settings = JSONField(blank=True) def __str__(self): return '%s (%s) - %s' % (self.name, self.owner.name, self.apikey) @@ -45,7 +45,7 @@ class api_heartbeat(models.Model): time_sent = models.DateTimeField(blank=False) time_rcvd = models.DateTimeField(blank=False) latency = models.FloatField(blank=False) - data = JSONField() + data = JSONField(blank=True) def __str__(self): return '%s (%s ms)' % (self.api.name, self.latency)