from applications.app.models import ZZ, Ajiltan, User

zz = ZZ.objects.all().first()

ajilchid = Ajiltan.objects.filter(baiguullaga = zz)

for a in ajilchid:
	u = User(username = a.e_mail, is_active = True, user_id = a)
	u.set_password('12345')
	u.save()
from applications.app.models import ZZ, Ajiltan, User

zz = ZZ.objects.all().first()

ajilchid = Ajiltan.objects.filter(baiguullaga=zz)

for a in ajilchid:
    u = User(username=a.e_mail, is_active=True, user_id=a)
    u.set_password('12345')
    u.save()
from applications.app.models import TZE, Ajiltan, User, TZE_Users_bind

tze_qs = TZE.objects.exclude(reg_num="2076675")
for tze in tze_qs:
    tze_ajiltan = Ajiltan.objects.filter(baiguullaga=tze)[0]
    tze_ajiltan.save()
    user = User(username=tze.reg_num, user_id=tze_ajiltan, is_active=True)
    user.set_password("12345")
    user.save()
    b = TZE_Users_bind(tze=tze, user_zahiral=user)
    b.save()

from applications.app.models import TZE, Ajiltan, User, TZE_Users_bind

tze_qs = TZE.objects.exclude(reg_num = '2076675')
for tze in tze_qs:
	tze_ajiltan = Ajiltan.objects.filter(baiguullaga = tze)[0]
	tze_ajiltan.save()
	user = User(username = tze.reg_num, user_id = tze_ajiltan, is_active = True)
	user.set_password('12345')
	user.save()
	b = TZE_Users_bind(tze = tze, user_zahiral = user)
	b.save()