Repository: learningequality/kolibri
Issue: Deleting channel metadata with null order breaks the signal handler

### Observed behavior
When deleting a channel with a null order value it throws an error.

### Expected behavior
Can delete channels regardless of if they have an order.

### User-facing consequences
Failure to delete channel metadata

### Errors and logs
```
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/mptt/models.py", line 1036, in delete
    return super(MPTTModel, self).delete(*args, **kwargs)
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/base.py", line 974, in delete
    return collector.delete()
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/deletion.py", line 279, in delete
    sender=model, instance=obj, using=self.using
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/dispatch/dispatcher.py", line 193, in send
    for receiver in self._live_receivers(sender)
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/core/content/signals.py", line 25, in reorder_channels_upon_deletion
    ChannelMetadata.objects.filter(order__gt=instance.order).update(
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/query.py", line 787, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/query.py", line 805, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/sql/query.py", line 1250, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/sql/query.py", line 1276, in _add_q
    allow_joins=allow_joins, split_subq=split_subq,
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/sql/query.py", line 1160, in build_filter
    value, lookups, used_joins = self.prepare_lookup_value(value, lookups, can_reuse, allow_joins)
  File "/home/richard/.pex/install/kolibri-0.13.0b5-py2.py3-none-any.whl.c9e9f91e7a24ffa73daf14b15360dc1b2b7ef3ab/kolibri-0.13.0b5-py2.py3-none-any.whl/kolibri/dist/django/db/models/sql/query.py", line 989, in prepare_lookup_value
    raise ValueError("Cannot use None as a query value")
ValueError: Cannot use None as a query value
```

### Steps to reproduce
Import a channel using `importchannel` then delete it with `deletechannel`.

### Context
Tell us about your environment, including:
 * 0.13.0beta5



Changed files:
kolibri/core/content/signals.py

diff --git a/kolibri/core/content/signals.py b/kolibri/core/content/signals.py
index 70b63f0565..b732c94af5 100644
--- a/kolibri/core/content/signals.py
+++ b/kolibri/core/content/signals.py
@@ -22,9 +22,10 @@ def reorder_channels_upon_deletion(sender, instance=None, *args, **kwargs):
     """
     For a given channel, decrement the order of all channels that come after this channel.
     """
-    ChannelMetadata.objects.filter(order__gt=instance.order).update(
-        order=F("order") - 1
-    )
+    if instance.order:
+        ChannelMetadata.objects.filter(order__gt=instance.order).update(
+            order=F("order") - 1
+        )
 
 
 @receiver(pre_delete, sender=ChannelMetadata)