• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pybb_tags.pybb_topic_poll_not_voted函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pybb.templatetags.pybb_tags.pybb_topic_poll_not_voted函数的典型用法代码示例。如果您正苦于以下问题:Python pybb_topic_poll_not_voted函数的具体用法?Python pybb_topic_poll_not_voted怎么用?Python pybb_topic_poll_not_voted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(TopicView, self).get_context_data(**kwargs)

        if self.request.user.is_authenticated():
            self.request.user.is_moderator = perms.may_moderate_topic(self.request.user, self.topic)
            self.request.user.is_subscribed = self.request.user in self.topic.subscribers.all()
            if perms.may_post_as_admin(self.request.user):
                ctx['form'] = self.get_admin_post_form_class()(
                    initial={'login': getattr(self.request.user, username_field)},
                    topic=self.topic)
            else:
                ctx['form'] = self.get_post_form_class()(topic=self.topic)
            self.mark_read(self.request.user, self.topic)
        elif defaults.PYBB_ENABLE_ANONYMOUS_POST:
            ctx['form'] = self.get_post_form_class()(topic=self.topic)
        else:
            ctx['form'] = None
            ctx['next'] = self.get_login_redirect_url()
        if perms.may_attach_files(self.request.user):
            aformset = self.get_attachment_formset_class()()
            ctx['aformset'] = aformset
        if defaults.PYBB_FREEZE_FIRST_POST:
            ctx['first_post'] = self.topic.head
        else:
            ctx['first_post'] = None
        ctx['topic'] = self.topic

        if self.request.user.is_authenticated() and self.topic.poll_type != Topic.POLL_TYPE_NONE and \
           pybb_topic_poll_not_voted(self.topic, self.request.user):
            ctx['poll_form'] = self.get_poll_form_class()(self.topic)

        return ctx
开发者ID:pbiogy,项目名称:pybbm,代码行数:32,代码来源:views.py


示例2: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(TopicView, self).get_context_data(**kwargs)
        ctx.update(get_intial_home_data(self.request))
        if self.request.user.is_authenticated():
            self.request.user.is_moderator = self.request.user.is_superuser or (self.request.user in self.topic.forum.moderators.all())
            self.request.user.is_subscribed = self.request.user in self.topic.subscribers.all()
            if perms.may_post_as_admin(self.request.user):
                ctx['form'] = AdminPostForm(initial={'login': self.request.user.username}, topic=self.topic)
            else:
                ctx['form'] = PostForm(topic=self.topic)
            self.mark_read(self.request, self.topic)
        elif defaults.PYBB_ENABLE_ANONYMOUS_POST:
            ctx['form'] = PostForm(topic=self.topic)
        else:
            ctx['form'] = None
        if defaults.PYBB_ATTACHMENT_ENABLE:
            aformset = AttachmentFormSet()
            ctx['aformset'] = aformset
        if defaults.PYBB_FREEZE_FIRST_POST:
            ctx['first_post'] = self.topic.head
        else:
            ctx['first_post'] = None
        ctx['topic'] = self.topic

        if self.request.user.is_authenticated() and self.topic.poll_type != Topic.POLL_TYPE_NONE and \
           pybb_topic_poll_not_voted(self.topic, self.request.user):
            ctx['poll_form'] = PollForm(self.topic)

        return ctx
开发者ID:heraldmatias,项目名称:pybbm,代码行数:29,代码来源:views.py


示例3: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(TopicView, self).get_context_data(**kwargs)
        if self.request.user.is_authenticated():
            self.request.user.is_moderator = perms.may_moderate_topic(self.request.user, self.topic)
            self.request.user.is_subscribed = self.request.user in self.topic.subscribers.all()
            if perms.may_post_as_admin(self.request.user):
                ctx["form"] = AdminPostForm(
                    initial={"login": getattr(self.request.user, username_field)}, topic=self.topic
                )
            else:
                ctx["form"] = PostForm(topic=self.topic)
            self.mark_read(self.request.user, self.topic)
        elif defaults.PYBB_ENABLE_ANONYMOUS_POST:
            ctx["form"] = PostForm(topic=self.topic)
        else:
            ctx["form"] = None
        if defaults.PYBB_ATTACHMENT_ENABLE:
            aformset = AttachmentFormSet()
            ctx["aformset"] = aformset
        if defaults.PYBB_FREEZE_FIRST_POST:
            ctx["first_post"] = self.topic.head
        else:
            ctx["first_post"] = None
        ctx["topic"] = self.topic

        if (
            self.request.user.is_authenticated()
            and self.topic.poll_type != Topic.POLL_TYPE_NONE
            and pybb_topic_poll_not_voted(self.topic, self.request.user)
        ):
            ctx["poll_form"] = PollForm(self.topic)

        return ctx
开发者ID:uservidya,项目名称:pybbm,代码行数:33,代码来源:views.py


示例4: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(TopicView, self).get_context_data(**kwargs)

        if self.request.user.is_authenticated():
            self.request.user.is_moderator = perms.may_moderate_topic(self.request.user, self.topic)
            self.request.user.is_subscribed = self.request.user in self.topic.subscribers.all()
            if perms.may_post_as_admin(self.request.user):
                ctx["form"] = self.get_admin_post_form_class()(
                    initial={"login": getattr(self.request.user, username_field)}, topic=self.topic
                )
            else:
                ctx["form"] = self.get_post_form_class()(topic=self.topic)
            self.mark_read(self.request.user, self.topic)
        elif defaults.PYBB_ENABLE_ANONYMOUS_POST:
            ctx["form"] = self.get_post_form_class()(topic=self.topic)
        else:
            ctx["form"] = None
            ctx["next"] = self.get_login_redirect_url()
        if perms.may_attach_files(self.request.user):
            aformset = self.get_attachment_formset_class()()
            ctx["aformset"] = aformset
        if defaults.PYBB_FREEZE_FIRST_POST:
            ctx["first_post"] = self.topic.head
        else:
            ctx["first_post"] = None
        ctx["topic"] = self.topic
        ctx["forum_id"] = self.topic.forum.id

        if perms.may_vote_in_topic(self.request.user, self.topic) and pybb_topic_poll_not_voted(
            self.topic, self.request.user
        ):
            ctx["poll_form"] = self.get_poll_form_class()(self.topic)

        return ctx
开发者ID:davoshack,项目名称:hub_health,代码行数:34,代码来源:views.py


示例5: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(TopicView, self).get_context_data(**kwargs)

        ctx['site'] = Site.objects.get_current()
        ctx['absolute_static'] = self.request.build_absolute_uri(staticfiles_storage.base_url)

        if self.request.user.is_authenticated():
            self.request.user.is_moderator = self.request.user.is_superuser or (self.request.user in self.topic.forum.moderators.all())
            self.request.user.is_subscribed = self.request.user in self.topic.subscribers.all()
            if self.request.user.is_staff:
                ctx['form'] = AdminPostForm(initial={'login': self.request.user.username}, topic=self.topic)
            else:
                ctx['form'] = PostForm(topic=self.topic)
            self.mark_read(self.request, self.topic)
        elif defaults.PYBB_ENABLE_ANONYMOUS_POST:
            ctx['form'] = PostForm(topic=self.topic)
        else:
            ctx['form'] = None
        if defaults.PYBB_ATTACHMENT_ENABLE:
            aformset = AttachmentFormSet()
            ctx['aformset'] = aformset
        if defaults.PYBB_FREEZE_FIRST_POST:
            ctx['first_post'] = self.topic.head
        else:
            ctx['first_post'] = None
        ctx['topic'] = self.topic

        ctx['watch_areas'] = self.get_watch_areas()\
            .filter(fence__intersects=self.topic.place)

        if self.request.user.is_authenticated() and self.topic.poll_type != Topic.POLL_TYPE_NONE and \
           pybb_topic_poll_not_voted(self.topic, self.request.user):
            ctx['poll_form'] = PollForm(self.topic)

        return ctx
开发者ID:openplans,项目名称:pybbm,代码行数:35,代码来源:views.py


示例6: form_valid

    def form_valid(self, form):
        # already voted
        if not pybb_topic_poll_not_voted(self.object, self.request.user):
            return HttpResponseForbidden()

        answers = form.cleaned_data['answers']
        for answer in answers:
            # poll answer from another topic
            if answer.topic != self.object:
                return HttpResponseBadRequest()

            PollAnswerUser.objects.create(poll_answer=answer, user=self.request.user)
        return super(ModelFormMixin, self).form_valid(form)
开发者ID:pbiogy,项目名称:pybbm,代码行数:13,代码来源:views.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.get_pybb_profile函数代码示例发布时间:2022-05-25
下一篇:
Python pybb_tags.pybb_topic_moderated_by函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap