Ejemplo n.º 1
0
    def show(self):
        from the_tale.forum.views import ThreadPageData

        thread_data = ThreadPageData()
        thread_data.initialize(account=self.account,
                               thread=self.post.forum_thread,
                               page=1,
                               inline=True)

        meta_post = meta_relations.Post.create_from_object(self.post)

        is_about_objects = [
            obj
            for relation, obj in meta_relations_logic.get_objects_related_from(
                relation=meta_relations.IsAbout, meta_object=meta_post)
        ]

        is_about_objects.sort(key=lambda obj: (obj.TYPE_CAPTION, obj.caption))

        return self.template(
            'blogs/show.html', {
                'post':
                self.post,
                'page_type':
                'show',
                'post_meta_object':
                meta_relations.Post.create_from_object(self.post),
                'is_about_objects':
                is_about_objects,
                'thread_data':
                thread_data,
                'vote':
                None if not self.account.is_authenticated() else
                prototypes.VotePrototype.get_for(self.account, self.post)
            })
Ejemplo n.º 2
0
    def show(self):
        from the_tale.forum.views import ThreadPageData

        thread_data = ThreadPageData()
        thread_data.initialize(account=self.account,
                               thread=self.bill.forum_thread,
                               page=1,
                               inline=True)

        return self.template(
            'bills/show.html', {
                'bill':
                self.bill,
                'thread_data':
                thread_data,
                'VOTE_TYPE':
                VOTE_TYPE,
                'page_type':
                'show',
                'bill_meta_object':
                meta_relations.Bill.create_from_object(self.bill),
                'vote':
                VotePrototype.get_for(self.account, self.bill)
                if self.account.is_authenticated else None,
                'can_vote':
                self.bill.can_vote(self.hero)
                if self.hero is not None else None
            })
Ejemplo n.º 3
0
    def show(self):
        from the_tale.forum.views import ThreadPageData

        thread_data = ThreadPageData()
        thread_data.initialize(account=self.account, thread=self.post.forum_thread, page=1, inline=True)

        meta_post = meta_relations.Post.create_from_object(self.post)

        is_about_objects = [
            obj
            for relation, obj in meta_relations_logic.get_objects_related_from(
                relation=meta_relations.IsAbout, meta_object=meta_post
            )
        ]

        is_about_objects.sort(key=lambda obj: (obj.TYPE_CAPTION, obj.caption))

        return self.template(
            "blogs/show.html",
            {
                "post": self.post,
                "page_type": "show",
                "post_meta_object": meta_relations.Post.create_from_object(self.post),
                "is_about_objects": is_about_objects,
                "thread_data": thread_data,
                "tags": models.Tag.objects.filter(
                    id__in=models.Tagged.objects.filter(post_id=self.post.id).values_list("tag", flat=True)
                ).order_by("name"),
                "vote": None
                if not self.account.is_authenticated
                else prototypes.VotePrototype.get_for(self.account, self.post),
            },
        )
Ejemplo n.º 4
0
def show(context):
    from the_tale.forum.views import ThreadPageData

    thread_data = None

    if context.news.forum_thread_id is not None:
        thread_data = ThreadPageData()
        thread_data.initialize(
            account=context.account,
            thread=forum_prototypes.ThreadPrototype.get_by_id(
                context.news.forum_thread_id),
            page=1,
            inline=True)

    return dext_views.Page('news/show.html',
                           content={
                               'news':
                               context.news,
                               'thread_data':
                               thread_data,
                               'news_meta_object':
                               meta_relations.News.create_from_object(
                                   context.news),
                               'resource':
                               context.resource
                           })
Ejemplo n.º 5
0
def show(context):
    from the_tale.forum.views import ThreadPageData

    thread_data = None

    if context.news.forum_thread_id is not None:
        thread_data = ThreadPageData()
        thread_data.initialize(account=context.account,
                               thread=forum_prototypes.ThreadPrototype.get_by_id(context.news.forum_thread_id),
                               page=1,
                               inline=True)

    return dext_views.Page('news/show.html',
                           content={'news': context.news,
                                    'thread_data': thread_data,
                                    'resource': context.resource} )
Ejemplo n.º 6
0
    def show(self):
        from the_tale.forum.views import ThreadPageData
        from the_tale.blogs import meta_relations as blogs_meta_relations

        thread_data = ThreadPageData()
        thread_data.initialize(account=self.account, thread=self.bill.forum_thread, page=1, inline=True)

        meta_bill = meta_relations.Bill.create_from_object(self.bill)

        return self.template('bills/show.html', {'bill': self.bill,
                                                 'thread_data': thread_data,
                                                 'VOTE_TYPE': VOTE_TYPE,
                                                 'page_type': 'show',
                                                 'bill_meta_object': meta_relations.Bill.create_from_object(self.bill),
                                                 'vote': VotePrototype.get_for(self.account, self.bill) if self.account.is_authenticated() else None,
                                                 'can_vote': self.bill.can_vote(self.hero) if self.hero is not None else None})
Ejemplo n.º 7
0
    def show(self):
        from the_tale.forum.views import ThreadPageData

        thread_data = ThreadPageData()
        thread_data.initialize(account=self.account, thread=self.post.forum_thread, page=1, inline=True)

        meta_post = meta_relations.Post.create_from_object(self.post)

        is_about_objects = [obj for relation, obj in meta_relations_logic.get_objects_related_from(relation=meta_relations.IsAbout, meta_object=meta_post)]

        is_about_objects.sort(key=lambda obj: (obj.TYPE_CAPTION, obj.caption))

        return self.template('blogs/show.html', {'post': self.post,
                                                 'page_type': 'show',
                                                 'post_meta_object': meta_relations.Post.create_from_object(self.post),
                                                 'is_about_objects': is_about_objects,
                                                 'thread_data': thread_data,
                                                 'vote': None if not self.account.is_authenticated() else prototypes.VotePrototype.get_for(self.account, self.post)})
Ejemplo n.º 8
0
    def show(self):
        from the_tale.forum.views import ThreadPageData
        from the_tale.blogs import meta_relations as blogs_meta_relations

        thread_data = ThreadPageData()
        thread_data.initialize(account=self.account, thread=self.bill.forum_thread, page=1, inline=True)

        meta_bill = meta_relations.Bill.create_from_object(self.bill)

        return self.template(
            "bills/show.html",
            {
                "bill": self.bill,
                "thread_data": thread_data,
                "VOTE_TYPE": VOTE_TYPE,
                "page_type": "show",
                "bill_meta_object": meta_relations.Bill.create_from_object(self.bill),
                "vote": VotePrototype.get_for(self.account, self.bill) if self.account.is_authenticated() else None,
                "can_vote": self.bill.can_vote(self.hero) if self.hero is not None else None,
            },
        )