forked from shrikant-pattawi/webd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
random_team_formation.py
53 lines (45 loc) · 1.56 KB
/
random_team_formation.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
52
53
import random, sys, os, django
import math
#sys.path.append("""E:\All_Projects\Python\Django\webd""")
os.environ.setdefault("DJANGO_SETTINGS_MODULE","Project.settings")
django.setup()
from accounts.models import User_details
from accounts.models import Team_details
from django.contrib.auth.models import User
def team_form() :
mem1 = User_details.objects.filter(authority=1).filter(data_verified=2)
mem2 = User_details.objects.filter(authority=2).filter(data_verified=2)
mem3 = User_details.objects.filter(authority=3).filter(data_verified=2)
mem4 = User_details.objects.filter(authority=4).filter(data_verified=2)
tm = Team_details.objects.all()
a=len(mem1)
b=len(mem2)
c=len(mem3)
d=len(mem4)
for i in tm:
try :
x = User_details.objects.filter(authority=1).filter(data_verified=2).first()
i.team_member_1 = x.user_user
x.data_verified = 3
x.save()
except :
pass
try :
x = User_details.objects.filter(authority=2).filter(data_verified=2).first()
i.team_member_2 = x.user_user
x.data_verified = 3
x.save()
except :
pass
try :
x = User_details.objects.filter(authority=3).filter(data_verified=2).first()
i.team_member_3 = x.user_user
x.data_verified = 3
x.save()
except :
pass
i.save()
y = User_details.objects.filter(user_user = i.team_leader)
y.data_verified = 3
y.save()
team_form()