本文整理匯總了Python中core.models.Project類的典型用法代碼示例。如果您正苦於以下問題:Python Project類的具體用法?Python Project怎麽用?Python Project使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Project類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_post_request
def test_post_request(self):
project_type = ProjectType(name='project_type_1', comments='some comments')
project_type.save()
project = Project(
project_type=project_type,
base_project='base_project',
work_project='work_project',
project_url='some url',
comments='comments related to this project',
)
project.save()
event_type = EventType(name='EVENT_XYZ', comments='comments related to EVENT_XYZ')
event_type.save()
resp = self.client.post(
'/api/events/',
{
'flow': 12,
'event_type': event_type.name,
'base_project': project.base_project,
'work_project': project.work_project,
'timestamp': '2015-11-12T15:16:17.000Z',
'user': 'someuser',
'comments': 'some comments related to event'
},
)
self.assertEqual(resp.status_code, HTTP_201_CREATED)
示例2: setUp
def setUp(self):
try:
self.user = User.objects.get_by_natural_key(USER_NAME)
except:
self.user = User.objects.create_user(USER_NAME, USER_MAIL, USER_PASS)
self.project = Project.newProject(PROJECT_NAME, self.user, PROJECT_URL, PROJECT_BUGTRACKER)
self.issue = Issue.newIssue(self.project, ISSUE_KEY, ISSUE_TITLE, ISSUE_DESCRIPTION, self.project.createdByUser, self.project.trackerURL)
示例3: _create_project
def _create_project(issueInfo, createdByUser):
project = Project.newProject(issueInfo.project_name, createdByUser, '', issueInfo.project_trackerURL)
project.save()
notify_admin("INFO: Project created from json view", "issue key: "+issueInfo.key+"\n<br>"+ \
"issue key: "+issueInfo.key+"\n<br>"+ \
"project : "+project.name+"\n<br>"+ \
"project.trackerURL: "+project.trackerURL+"\n<br>")
return project
示例4: __init__
def __init__(self):
# create dummy_user
user_model = get_user_model()
dummy_user = user_model.objects.create_user(
'test_user_username',
'[email protected]',
'test_password'
)
dummy_user.save()
self.dummy_user = dummy_user
# create human contact
dummy_human = Humans()
dummy_human.user = dummy_user
dummy_human.department = 'management'
dummy_human.department = 'general-manager'
dummy_human.phone = '0123456789'
dummy_human.address = 'dummy user test address'
dummy_human.personal_email = '[email protected]'
dummy_human.enrolled = datetime.now()
dummy_human.save()
self.dummy_human = dummy_human
# create a dummy client
dummy_client = Client()
dummy_client.name = 'test_client_name'
dummy_client.manager = self.dummy_human
dummy_client.save()
self.dummy_client = dummy_client
# create a dummy brand
dummy_brand = Brand()
dummy_brand.name = 'brand_test_name'
dummy_brand.client = self.dummy_client
dummy_brand.save()
self.dummy_brand = dummy_brand
# create a dummy project
dummy_project = Project()
dummy_project.name = 'test_project_name'
dummy_project.short_code = "test_prj_dir_name"
dummy_project.client = self.dummy_client
dummy_project.brand = self.dummy_brand
self.dummy_project = dummy_project
示例5: test_post_raise_400_when_missing_base_project
def test_post_raise_400_when_missing_base_project(self):
project_type2 = ProjectType(name='project_type_2', comments='some comments')
project_type2.save()
project2 = Project(
project_type=project_type2,
base_project='base_project_5',
work_project='work_project_5',
project_url='some url',
comments='comments related to this project',
)
project2.save()
resp = self.client.post(
'/api/flows/',
{
'number': 7,
'work_project': project2.work_project,
'timestamp': '2015-12-23T12:34:56.000Z',
'status': 0,
'comments': 'comments related to project',
})
self.assertEqual(resp.status_code, HTTP_400_BAD_REQUEST)
示例6: _buildOfferFromDictionary
def _buildOfferFromDictionary(dict, user):
check_noProject = dict.has_key('noProject')
issue_trackerURL = dict['trackerURL']
issue_projectId = dict['project_id']
issue_projectName = dictOrEmpty(dict, 'project_name')
check_createProject = dict.has_key('createProject')
newProject_name = dictOrEmpty(dict, 'newProjectName')
newProject_homeURL = dictOrEmpty(dict, 'newProjectHomeURL')
newProject_trackerURL = dictOrEmpty(dict, 'newProjectTrackerURL')
issue_key = dictOrEmpty(dict, 'key');
issue_title = dictOrEmpty(dict, 'title');
issue_description = dictOrEmpty(dict, 'description');
_throwIfIssueExists(issue_trackerURL, user)
issue = None
if(check_noProject):
if(not issue_title or not issue_description):
raise BaseException('title and description are required')
issue = Issue.newIssueOrphan(issue_title, issue_description, user)
else:
project = None
if(check_createProject):
if(not newProject_name or not newProject_homeURL or not newProject_trackerURL):
raise BaseException('all parameters for new project are required')
projectHomeURLValidationError = validateURL(newProject_homeURL)
if(projectHomeURLValidationError):
raise BaseException('invalid project URL ('+newProject_homeURL+') - '+projectHomeURLValidationError)
projectTrackerURLValidationError = validateURL(newProject_trackerURL)
if(projectTrackerURLValidationError):
raise BaseException('invalid project tracker URL ('+newProject_trackerURL+') - '+projectTrackerURLValidationError)
project = Project.newProject(newProject_name, user, newProject_homeURL, newProject_trackerURL)
else:
project = Project.objects.get(pk=int(issue_projectId))
if(newProject_homeURL != project.homeURL):
project.homeURL = newProject_homeURL
if(not issue_key or not issue_title):
raise BaseException('key and title are required')
issueURLValidationError = validateIssueURL(issue_trackerURL)
if(issueURLValidationError):
raise BaseException('invalid issue URL ('+issue_trackerURL+') - '+issueURLValidationError)
issue = Issue.newIssue(project, issue_key, issue_title, user, issue_trackerURL)
return _buildOfferFromDictionary_and_issue(dict, user, issue);
示例7: create_project
def create_project(request):
project_name = request.POST.get("projectname")
project_cost = request.POST.get("projectcost")
p = Project(name=project_name, price_per_hour=project_cost)
p.save()