old_contents: import json
  from django.core.management.base import BaseCommand
  from django.conf import settings
  from ... import models
  
  
  class Command(BaseCommand):
  
      help = "Register a collection"
  
      def add_arguments(self, parser):
          parser.add_argument('snoop_collections')
  
      def handle(self, snoop_collections, **kwargs):
          snoop_base_url = settings.SNOOP_BASE_URL
          assert snoop_base_url
  
          for conf in json.loads(snoop_collections):
              name = conf['name']
              col, created = models.Collection.objects.update_or_create(
                  name=name,
                  defaults=dict(
                      index=name,
                      # these should be editable from the ui:
                      # title=name.title(),
                      # public=conf.get('public', False),
                  ),
              )
              action = "Created" if created else "Updated"
              print(action, col)
  
new_contents: import json
  from django.core.management.base import BaseCommand
  from django.conf import settings
  from ... import models
  
  
  class Command(BaseCommand):
  
      help = "Register a collection"
  
      def add_arguments(self, parser):
          parser.add_argument('snoop_collections')
  
      def handle(self, snoop_collections, **kwargs):
          snoop_base_url = settings.SNOOP_BASE_URL
          assert snoop_base_url
  
          for conf in json.loads(snoop_collections):
              name = conf['name']
              col, created = models.Collection.objects.update_or_create(
                  name=name,
                  defaults=dict(
                      index=name,
                  ),
              )
              if created or not col.title:
                  col.title = name
                  col.save()
  
              action = "Created" if created else "Updated"
              print(action, col)
  
subject: fix collection blank title