Changeset e9af979
- Timestamp:
- Mar 23, 2012, 1:29:29 AM (14 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- bbaf690
- Parents:
- b90b977
- git-author:
- Alex Dehnert <adehnert@…> (03/23/12 01:29:29)
- git-committer:
- ASA Group Database <asa-db@…> (03/23/12 01:29:29)
- File:
-
- 1 edited
-
asadb/groups/format_groups.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/groups/format_groups.py
rb90b977 re9af979 12 12 13 13 from django.db.models import Q 14 from django.utils import html 14 15 15 16 import groups.models … … 34 35 'predicate' : Qsa, 35 36 }, 37 'midway' : { 38 'prefix': """ 39 <!-- Automatically generated by %(script)s %(mode)s. 40 Do not edit; instead re-run that script (or edit it as necessary). --> 41 <select name="groupname" size="5" style="width:500px"> 42 """, 43 'suffix': "</select>", 44 'format' : '<option value="%(html_name)s">%(html_name)s</option>', 45 'predicate' : Q(group_status__slug__in=['active', 'suspended', 'applying', 'nge'], group_class__gets_publicity=True, ), 46 }, 36 47 } 37 48 38 49 def do_output(mode): 39 format = functions[mode]['format'] 40 predicate = functions[mode]['predicate'] 50 spec = functions[mode] 51 format = spec['format'] 52 predicate = spec['predicate'] 41 53 gs = groups.models.Group.objects.filter(predicate) 54 static_args = {'script': 'groups/format_groups.py', 'mode':mode, } 55 if 'prefix' in spec: 56 print spec['prefix'] % static_args 42 57 for group in gs: 43 58 print format % { 44 59 'name':group.name, 60 'html_name':html.escape(group.name), 45 61 'officer_email':group.officer_email, 46 62 } 63 if 'suffix' in spec: 64 print spec['suffix'] % static_args 47 65 48 66 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.