-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathproject_fixer.py
51 lines (45 loc) · 1.76 KB
/
project_fixer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os, django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "UnoCPI.settings")
django.setup()
from projects.models import *
for projmis in ProjectMission.objects.all():
try:
for proj in Project.objects.all():
if proj.id == projmis.project_name.id:
print("Match on: ")
print(projmis.project_name)
print(proj.project_name)
print(projmis.mission)
Project.objects.get(id=proj.id).mission_area.add(projmis.mission)
except Exception as e:
print(e)
for projcamp in ProjectCampusPartner.objects.all():
try:
for proj in Project.objects.all():
if proj.id == projcamp.project_name.id:
print("Match on: ")
print(projcamp.project_name)
print(proj.project_name)
Project.objects.get(id=proj.id).campus_partner.add(projcamp.campus_partner)
except Exception as e:
print(e)
for projcom in ProjectCommunityPartner.objects.all():
try:
for proj in Project.objects.all():
if proj.id == projcom.project_name.id:
print("Match on: ")
print(projcom.project_name)
print(proj.project_name)
Project.objects.get(id=proj.id).community_partner.add(projcom.community_partner)
except Exception as e:
print(e)
for projsub in ProjectSubCategory.objects.all():
try:
for proj in Project.objects.all():
if proj.id == projsub.project_name.id:
print("Match on: ")
print(projsub.project_name)
print(proj.project_name)
Project.objects.get(id=proj.id).subcategory.add(projsub.sub_category)
except Exception as e:
print(e)