space-accessstablestage
|
Last change
on this file since c4282e2 was
a8cd440,
checked in by Alex Dehnert <adehnert@…>, 14 years ago
|
|
Data verification infrastructure (Trac: #22)
This includes:
- a script to remove data that we want people to verify
(groups/purge_for_transition.py)
- code to make more fields required in the normal update interface
- explanatory message to help people with problematic constitutions
- adding an "Other" activity category so we can require that field
|
-
Property mode set to
100755
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | import os |
|---|
| 3 | import sys |
|---|
| 4 | |
|---|
| 5 | if __name__ == '__main__': |
|---|
| 6 | cur_file = os.path.abspath(__file__) |
|---|
| 7 | django_dir = os.path.abspath(os.path.join(os.path.dirname(cur_file), '..')) |
|---|
| 8 | sys.path.append(django_dir) |
|---|
| 9 | os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' |
|---|
| 10 | |
|---|
| 11 | import groups.models |
|---|
| 12 | from django.db import transaction |
|---|
| 13 | from django.db.models import Q |
|---|
| 14 | |
|---|
| 15 | def clean_group(group): |
|---|
| 16 | group.activity_category = None |
|---|
| 17 | group.description = "" |
|---|
| 18 | |
|---|
| 19 | group.num_undergrads = None |
|---|
| 20 | group.num_grads = None |
|---|
| 21 | group.num_community = None |
|---|
| 22 | group.num_other = None |
|---|
| 23 | |
|---|
| 24 | group.website_url = "" |
|---|
| 25 | group.meeting_times = "" |
|---|
| 26 | group.officer_email = "" |
|---|
| 27 | group.group_email = "" |
|---|
| 28 | |
|---|
| 29 | group.constitution_url = "" |
|---|
| 30 | group.advisor_name = "" |
|---|
| 31 | group.athena_locker = "" |
|---|
| 32 | |
|---|
| 33 | officers = group.officers().filter(~Q(role__slug='president')) |
|---|
| 34 | for officer in officers: officer.expire() |
|---|
| 35 | |
|---|
| 36 | group.set_updater("importer@SYSTEM") |
|---|
| 37 | group.save() |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | @transaction.commit_on_success |
|---|
| 41 | def clean_groups(): |
|---|
| 42 | for group in groups.models.Group.active_groups.all(): |
|---|
| 43 | clean_group(group) |
|---|
| 44 | |
|---|
| 45 | if __name__ == '__main__': |
|---|
| 46 | clean_groups() |
|---|
Note: See
TracBrowser
for help on using the repository browser.