本文整理汇总了Python中issues.models.Issue类的典型用法代码示例。如果您正苦于以下问题:Python Issue类的具体用法?Python Issue怎么用?Python Issue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Issue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_proposal
def test_create_proposal(self):
i = Issue(community=self.community, title="Issue ABC",
created_by=self.chairmen[0])
i.full_clean()
i.save()
title = 'Proposal XYZ'
content = 'hellow world'
self.assertEquals(0, Proposal.objects.count())
self.login_chairmen()
url = reverse('proposal_create', args=(self.community.id, i.id))
response = self.client.get(url)
self.assertEquals(200, response.status_code)
response = self.client.post(url, {
'proposal-type': ProposalType.RULE,
'proposal-title': title,
'proposal-content': content,
'proposal-tags': 'tag1,tag2,tag3',
})
self.assertEquals(200, response.status_code)
# Ajax call returns a partial html
self.assertEquals(1, Proposal.objects.count())
p = Proposal.objects.all()[0]
assert isinstance(p, Proposal)
self.assertContains(response, p.get_absolute_url())
self.assertEquals(title, p.title)
self.assertEquals(content, p.content)
示例2: testIssueNotification
def testIssueNotification(self):
user = create_user()
issue = Issue()
issue.description = "This is a test"
issue.save()
assert Issue.all().count() == 1
示例3: issue_by_number
def issue_by_number(pk):
""" Get's the issue by a primary key or a number, i like hacking the url so
you can just put in a number in the URL """
number = safe_int(pk)
if number:
issues = Issue.all().filter("number = ", number)
return issues[0]
else:
return Issue.get(pk)
示例4: create
def create(request):
sunetid = request.user.webauth_username
attrs = request.POST.copy()
if len(attrs) == 0 or 'kind' not in attrs:
return HttpResponseNotFound("The form did not submit correctly. Please try again.")
new_issue = Issue(kind=attrs['kind'], sunetid1=sunetid).get_typed()
form = form_class_for_issue(new_issue)(attrs, instance=new_issue)
if form.is_valid() and new_issue.can_declare():
form.save()
return HttpResponseRedirect(reverse('issues.views.manage_index'))
else:
return render_to_response('issues/manage/new.html', {'new_issue': new_issue, 'form': form,'error': True}, context_instance=RequestContext(request))
示例5: delete
def delete(self, *args, **kwargs):
"""docstring for delete"""
from issues.models import Issue
from resources.models import Resource, Curation
res = Resource.objects(owner=self)
curs = Curation.objects(owner=self)
if curs.count() or res.count():
raise Exception('This account owns resources/curations.')
Collection.objects(owner=self).delete()
Issue.objects(reporter=self).delete()
User.objects.get(pk=self.local_id).delete()
self.reindex(remove=True)
super(Account, self).delete(*args, **kwargs)
示例6: test_vote_proposal
def test_vote_proposal(self):
# p = self.test_create_proposal()
######################################
i = Issue(community=self.community, title="Issue ABC",
created_by=self.chairmen[0])
i.full_clean()
i.save()
title = 'Proposal XYZ'
content = 'hellow world'
p = Proposal.objects.create(type=ProposalType.RULE, issue=i, created_by=self.chairmen[0], title=title, content=content)
######################################
#TODO: create this via HTML request
pv = ProposalVote(proposal=p, user=self.members[0], value=ProposalVoteValue.CON)
pv.full_clean()
pv.save()
return pv
示例7: setUp
def setUp(self):
for issue in Issue.all(): issue.delete()
for log in Log.all(): log.delete()
for comment in Comment.all(): comment.delete()
for group in Group.all(): group.delete()
for error in Error.all(): error.delete()
for project in Project.all(): project.delete()
示例8: sync
def sync(self, tracker):
server = ServerProxy(tracker.config, allow_none=True,
use_datetime=datetime)
last_update = DateTime(time.mktime(tracker.last_update.timetuple()))
users = self._get_users(server)
ids = map(int, server.filter('issue', None, {'activity':
str(last_update)}))
for issue_id in ids:
data = server.display('issue%d' % issue_id, 'title', 'creation',
'creator', 'assignedto', 'activity',
'messages', 'status')
issue = Issue.by_tracker_id(tracker.id, issue_id)
issue.no = issue_id
issue.set_title(data.get('title', ''))
issue.set_description(self._get_description(
server, data.get('messages', [])))
issue.reporter = users[int(data['creator'])]
issue.owner = users[int(data['assignedto'])]
issue.last_change = _roundup_date_to_datetime(data.get('activity'))
status = int(data.get('status', -1))
issue.active = status in ACTIVE_STATUS
issue.tracker = tracker
if not issue.id:
issue.created = datetime.now()
issue.updated = datetime.now()
issue.save()
post_issue_sync.send(sender=self, issue=issue)
self._update_user_data(server, data, issue, users)
tracker.last_update = datetime.now() - timedelta(days=1)
tracker.save()
post_tracker_sync.send(sender=self, tracker=tracker)
return True
示例9: setUp
def setUp(self):
self.year = Year.objects.create(start_year=2016)
self.group = Group.objects.create(name='name_groups', year=self.year)
self.course = Course.objects.create(name='course_name',
year=self.year)
self.course.groups = [self.group]
self.course.save()
self.task = Task.objects.create(title='task',
course=self.course,
problem_id="A")
self.student = User.objects.create_user(username='student',
password='password')
self.responsible = User.objects.create_user(username='responsible',
password='password')
status = IssueStatus.objects.get(tag=Issue.STATUS_ACCEPTED)
self.issue = Issue()
self.issue.student = self.student
self.issue.task = self.task
self.issue.responsible = self.responsible
self.issue.status_field = status
self.issue.save()
self.issue.save()
self.issue_id = self.issue.id
示例10: handle
def handle(self, count, service, min_lat=None, max_lat=None, min_lon=None, max_lon=None, **options):
service = Service.objects.get(service_code=service)
for i in range(count):
lat = long = None
if min_lat and max_lat and min_lon and max_lon:
lat = random.uniform(min_lat, max_lat)
long = random.uniform(min_lon, max_lon)
issue = Issue(
service=service,
lat=lat,
long=long,
submitter_email='[email protected]',
description=generate_description(),
)
issue.save()
self.stdout.write('{} issues created'.format(count))
示例11: test_get_or_create_anonymously
def test_get_or_create_anonymously(self):
client = self.client
# get get_or_create page
response = client.get(reverse('issues.views.get_or_create',
kwargs={'task_id': self.task.id, 'student_id': self.student.id}))
self.assertEqual(response.status_code, 302, "Need login for get_or_create")
issue = Issue()
issue.student = self.student
issue.task = self.task
issue.save()
# get issue_page page
response = client.get(reverse('issues.views.issue_page',
kwargs={'issue_id': issue.id}))
self.assertEqual(response.status_code, 302, "Need login for issue_page")
示例12: setUp
def setUp(self):
u = SandstormUser(sid="xxxdummyxxx", name="Dummy User", handle="dummy")
u.save()
i1 = Issue(title="Foo", description="describe Foo", creator=u, deadline=date.today())
i1.save()
i2 = Issue(title="Bar", description="describe Bar", for_anon=True, creator=u, deadline=date.today() + timedelta(days=2))
i2.save()
i3 = Issue(title="Baz", description="describe Baz", subscriber_only=True, creator=u)
i3.save()
c1_1 = Comment(body="Hohoho", issue=i1, creator=u)
c1_1.save()
c2_1 = Comment(body="Funny!", issue=i1, creator=u)
c2_1.save()
示例13: testIssueAndErrorNotification
def testIssueAndErrorNotification(self):
user = create_user()
issue = Issue()
issue.description = "This is a test"
issue.save()
assert Issue.all().count() == 1
c = Client()
c.post(reverse("error-post"), test_data)
#assert Notification.all().count() == 2
# this would be 2 when issues are turned on
assert Notification.all().count() == 1
c = Client()
res = c.get(reverse("notification-send"))
self.assertEquals(len(mail.outbox), 1)
示例14: testIssueURL
def testIssueURL(self):
self._setup()
self.issue = Issue()
self.issue.description = "This is a test"
self.issue.project = self.project
self.issue.save()
assert self.issue.issueprojecturl_set.count() == 2
assert self.issue.issueprojecturl_set[0].status == "not_fixed"
示例15: edit_project_url
def edit_project_url(request, pk):
issue = Issue.get(pk)
urls = IssueProjectURL.all().filter("issue = ", issue)
url_ids = dict([ (url.id, url) for url in urls ])
if request.POST:
for key, value in request.POST.items():
if key in url_ids:
assert value in [ i[0] for i in issue_project_url_statuses ], \
"%s not in %s" % (value, issue_project_url_statuses)
url_ids[key].status = value
url_ids[key].save()
return HttpResponseRedirect(reverse("issues-view", args=[pk,]))
return direct_to_template(request, "issue_project_url.html", extra_context={
"issue": issue,
"urls": urls,
"issue_project_url_statuses": issue_project_url_statuses,
"nav": {"selected": "issues",},
})