Exemplo n.º 1
0
import os, django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PDT.settings")
django.setup()
from projects.models import ManagerRegister, DeveloperRegister
from users.models import UserProfile
from django.contrib.auth.models import User
import time

nxt_m_id = User.objects.count()+1
user = User.objects.create_user('M_'+str(nxt_m_id), '*****@*****.**', 'johnpassword')
u = UserProfile(user=user, staff_id=nxt_m_id, role='m')
u.save()

project_id = ManagerRegister.create_project(u, "Demo Project")
project = ManagerRegister.get_project_by_id(u, project_id)
if ManagerRegister.start_project(u, project_id):
	print("The project is started")
	if ManagerRegister.next_phase(u, project_id):
		project = ManagerRegister.get_project_by_id(u, project_id)
		print("current active phase: " + str(len(project.phase_set.filter(active=True))))
		print("the phase is switched to: "+ str(project.get_current_phase()))
		phase = project.get_current_phase()
		if ManagerRegister.next_iteration(u, project_id):
			print("\tthe phase is switched to: "+str(project.get_current_phase().get_current_iteration()))
			print("\tcurrent active iteration: " + str(len(project.get_current_phase().iteration_set.filter(active=True))))

nxt_d_id = User.objects.count()+1
user = User.objects.create_user('D_'+str(nxt_d_id), '*****@*****.**', 'johnpassword')
d = UserProfile(user=user,staff_id=nxt_d_id, role='d')
d.save()
Exemplo n.º 2
0
django.setup()

from users.models import UserProfile
from projects.models import ManagerRegister
from django.contrib.auth.models import User
from reports.models import ProgressReport, DefectReport
from django.utils import timezone

print("test_started")

nxt_m_id = User.objects.count()+1
user = User.objects.create_user('M_'+str(nxt_m_id), 'les.com', 'ssword')
u = UserProfile(user=user, staff_id=nxt_m_id, role='m')
u.save()

project_id = ManagerRegister.create_project(u, "report Project")
project = ManagerRegister.get_project_by_id(u, project_id)
if ManagerRegister.start_project(u, project_id):
	print("The project is started")

print("The manager is called" + str(u.user.username))

for i in range(4):
	## get next phase of the project
		## create progress report
		if ManagerRegister.next_phase(u, project_id):
			project = ManagerRegister.get_project_by_id(u, project_id)
			print("current active phase: " + str(len(project.phase_set.filter(active=True))))
			print("the project is switched to: "+str(project.get_current_phase()))
			for j in range(3):
				phase = project.get_current_phase()
Exemplo n.º 3
0
def create(request): 
  name = request.POST['name']
  manager = request.user.userprofile
  p_id = ManagerRegister.create_project(manager, name)
  return redirect(index_selected, p_id, 'panel1')