当前位置: 首页>>代码示例>>Python>>正文


Python Issue.student方法代码示例

本文整理汇总了Python中issues.models.Issue.student方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.student方法的具体用法?Python Issue.student怎么用?Python Issue.student使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在issues.models.Issue的用法示例。


在下文中一共展示了Issue.student方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_or_create_anonymously

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import student [as 别名]
    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")
开发者ID:znick,项目名称:anytask,代码行数:19,代码来源:tests.py

示例2: test_issue_create_filled

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import student [as 别名]
    def test_issue_create_filled(self):
        year = Year.objects.create(start_year=2016)
        group = Group.objects.create(name='name_groups', year=year)
        course = Course.objects.create(name='course_name',
                                       year=year)
        course.groups = [group]
        course.save()
        task = Task.objects.create(title='task',
                                   course=course)
        student = User.objects.create_user(username='student',
                                           password='password')
        responsible = User.objects.create_user(username='responsible',
                                               password='password')
        followers = [User.objects.create_user(username='follower1',
                                              password='password')]

        status = IssueStatus.objects.get(name=u'{"ru": "Зачтено", "en": "Accepted"}')

        issue = Issue()
        issue.student = student
        issue.task = task
        issue.mark = 3
        issue.responsible = responsible
        issue.status_field = status
        issue.save()
        issue.followers = followers
        issue.save()
        issue_id = issue.id

        issue = Issue.objects.get(id=issue_id)

        self.assertIsInstance(issue, Issue)
        self.assertEqual(issue.student, student)
        self.assertEqual(issue.task, task)
        self.assertEqual(issue.mark, 3)
        self.assertEqual(issue.responsible, responsible)
        self.assertEqual(issue.status_field, status)
        self.assertItemsEqual(issue.followers.all(), followers)
开发者ID:znick,项目名称:anytask,代码行数:40,代码来源:tests.py

示例3: _submit_review

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import student [as 别名]
    def _submit_review(self, request, task, svn_path):
        user = request.user

        try:
            rev_a = int(request.POST.get('rev_a'))
            rev_b = int(request.POST.get('rev_b'))
        except TypeError: #not int
            return HttpResponseForbidden()
        except ValueError: #not int
            return HttpResponseForbidden()

        if rev_a == rev_b:
            return HttpResponseForbidden()

        if rev_b < rev_a:
            rev_a, rev_b = rev_b, rev_a

        review_id = None
        try:
            issue = Issue.objects.filter(task=task, student=user).order_by('-update_time')[0]
            review_id = issue.rb_review_id
        except Issue.DoesNotExist:
            pass
        except IndexError:
            pass

        issue = Issue()
        issue.task = task
        issue.student = user
        issue.svn_commit_id = rev_b

        summary = u"[{0}][{1}] {2}".format(user.get_full_name(), task.course.get_user_group(user), task.title)

        review_group_name = settings.RB_API_DEFAULT_REVIEW_GROUP
        if task.course.name_id:
            review_group_name =  "teachers_{0}".format(task.course.name_id)
        else:
            try:
                review_group_name = "teachers_{0}".format(task.course.name)
            except Exception:
                pass

        review_group_name = review_group_name.replace(".", "_")
        review_group_name = review_group_name.replace("/", "_")
        review_group_name = review_group_name.lower()

        anyrb = AnyRB()

        description = self._get_description(request, task, svn_path, rev_a, rev_b)
        if review_id is None:
            review_id = anyrb.submit_review(user, rev_a, rev_b, summary=summary, description=description, review_group_name=", ".join((review_group_name, settings.RB_API_DEFAULT_REVIEW_GROUP)),  path=svn_path)
        else:
            anyrb.update_review(user, rev_a, rev_b, review_id, description=description, path=svn_path)

        issue.rb_review_id = review_id
        issue.save()

        context = {
            'review_url' : anyrb.get_review_url(request, review_id),
            'task' : task,
        }

        return render_to_response('submit_review_done.html', context, context_instance=RequestContext(request))
开发者ID:BooleT37,项目名称:anytask,代码行数:65,代码来源:views.py


注:本文中的issues.models.Issue.student方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。