diff --git a/docs/changelog.rst b/docs/changelog.rst index 409fb347c..a63eae574 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -18,6 +18,15 @@ Please make sure you have a fresh **database backup** before upgrading! Upgradin +v1.23.1 - 2018-08-26 +^^^^^^^^^^^^^^^^^^^^ + +**Tickets resolved in this release:** + +- [`#515 `_] Missing mqtt values + + + v1.23.0 - 2018-08-02 ^^^^^^^^^^^^^^^^^^^^ diff --git a/dsmr_mqtt/migrations/0008_mqtt_null_payload.py b/dsmr_mqtt/migrations/0008_mqtt_null_payload.py new file mode 100644 index 000000000..a79ef4632 --- /dev/null +++ b/dsmr_mqtt/migrations/0008_mqtt_null_payload.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1 on 2018-08-26 12:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dsmr_mqtt', '0007_mqtts'), + ] + + operations = [ + migrations.AlterField( + model_name='message', + name='payload', + field=models.TextField(blank=True, null=True), + ), + ] diff --git a/dsmr_mqtt/models/queue.py b/dsmr_mqtt/models/queue.py index 4c7583f7e..c098ebb27 100644 --- a/dsmr_mqtt/models/queue.py +++ b/dsmr_mqtt/models/queue.py @@ -5,7 +5,7 @@ class Message(models.Model): """ Queued message for MQTT. """ topic = models.CharField(max_length=255) - payload = models.TextField() + payload = models.TextField(null=True, blank=True) def __str__(self): return self.topic diff --git a/dsmr_mqtt/tests/models/test_queue.py b/dsmr_mqtt/tests/models/test_queue.py index 92e13de39..e318019d9 100644 --- a/dsmr_mqtt/tests/models/test_queue.py +++ b/dsmr_mqtt/tests/models/test_queue.py @@ -15,3 +15,7 @@ def test_admin(self): def test_to_string(self): self.assertEqual(str(self.instance), '{}'.format(self.instance.topic)) + + def test_null_payload(self): + """ This caused many headaches in issue #515. """ + Message.objects.create(topic='x', payload=None) diff --git a/dsmrreader/__init__.py b/dsmrreader/__init__.py index 75940247f..fb89722d1 100644 --- a/dsmrreader/__init__.py +++ b/dsmrreader/__init__.py @@ -17,6 +17,6 @@ from django.utils.version import get_version -VERSION = (1, 23, 0, 'final', 0) +VERSION = (1, 23, 1, 'final', 0) __version__ = get_version(VERSION)