Index: asadb/groups/format_groups.py
===================================================================
--- asadb/groups/format_groups.py	(revision b90b977c3ed521bf287f5e7ddb5899601a5bbb6d)
+++ asadb/groups/format_groups.py	(revision e9af97900a7fefc5d6d2ee78d02b9faf0a4d7c99)
@@ -12,4 +12,5 @@
 
 from django.db.models import Q
+from django.utils import html
 
 import groups.models
@@ -34,15 +35,32 @@
         'predicate' : Qsa,
     },
+    'midway' : {
+        'prefix': """
+        <!-- Automatically generated by %(script)s %(mode)s.
+        Do not edit; instead re-run that script (or edit it as necessary). -->
+        <select name="groupname" size="5" style="width:500px">
+        """,
+        'suffix': "</select>",
+        'format' : '<option value="%(html_name)s">%(html_name)s</option>',
+        'predicate' : Q(group_status__slug__in=['active', 'suspended', 'applying', 'nge'], group_class__gets_publicity=True, ),
+    },
 }
 
 def do_output(mode):
-    format = functions[mode]['format']
-    predicate = functions[mode]['predicate']
+    spec = functions[mode]
+    format = spec['format']
+    predicate = spec['predicate']
     gs = groups.models.Group.objects.filter(predicate)
+    static_args = {'script': 'groups/format_groups.py', 'mode':mode, }
+    if 'prefix' in spec:
+        print spec['prefix'] % static_args
     for group in gs:
         print format % {
             'name':group.name,
+            'html_name':html.escape(group.name),
             'officer_email':group.officer_email,
         }
+    if 'suffix' in spec:
+        print spec['suffix'] % static_args
 
 if __name__ == "__main__":
