Esempio n. 1
0
class PostPage(Page):
    body = MarkdownField()
    date = models.DateTimeField(verbose_name="Post date",
                                default=datetime.today)
    body_stream = StreamField(
        [('heading', blocks.CharBlock(classname='full title')),
         ('paragraph', blocks.RichTextBlock()), ('image', ImageChooserBlock()),
         ('code', CodeBlock())],
        blank=True)

    excerpt = MarkdownField(
        verbose_name='excerpt',
        blank=True,
    )

    header_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
    )

    categories = ParentalManyToManyField('blog.BlogCategory', blank=True)
    tags = ClusterTaggableManager(through='blog.BlogPageTag', blank=True)

    content_panels = Page.content_panels + [
        ImageChooserPanel('header_image'),
        MarkdownPanel("body"),
        MarkdownPanel("excerpt"),
        StreamFieldPanel("body_stream"),
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        FieldPanel('tags'),
    ]

    settings_panels = Page.settings_panels + [
        FieldPanel('date'),
    ]

    @property
    def blog_page(self):
        return self.get_parent().specific

    '''
    @property
    def category_page(self):
        return self.get_parent().specific
   '''

    def get_context(self, request, *args, **kwargs):
        context = super(PostPage, self).get_context(request, *args, **kwargs)
        context['blog_page'] = self.blog_page
        #context['category_page'] = self.category_page
        context['post'] = self
        return context
Esempio n. 2
0
class PostPage(Page):
    body = MarkdownField()
    date = models.DateTimeField(verbose_name="Post date",
                                default=datetime.datetime.today)
    excerpt = MarkdownField(
        verbose_name='excerpt',
        blank=True,
    )

    header_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
    )

    categories = ParentalManyToManyField('marcas.MarcasCategory', blank=True)
    tags = ClusterTaggableManager(through='marcas.MarcasPageTag', blank=True)

    content_panels = Page.content_panels + [
        ImageChooserPanel('header_image'),
        MarkdownPanel("body"),
        MarkdownPanel("excerpt"),
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        FieldPanel('tags'),
    ]

    search_fields = Page.search_fields + [  # Inherit search_fields from Page
        index.SearchField('body', partial_match=True),
        index.SearchField('excerpt', partial_match=True),
        index.FilterField('date'),
        index.RelatedFields('categories', [
            index.SearchField('name'),
        ]),
    ]

    settings_panels = Page.settings_panels + [
        FieldPanel('date'),
    ]

    @property
    def marcas_page(self):
        return self.get_parent().specific

    def get_context(self, request, *args, **kwargs):
        context = super(PostPage, self).get_context(request, *args, **kwargs)
        context['marcas_page'] = self.marcas_page
        context['post'] = self
        return context
Esempio n. 3
0
class PostPage(Page):
    body = MarkdownField()
    date = models.DateTimeField(verbose_name="Post date", default=datetime.datetime.today)

    header_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True, blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
    )

    categories = ParentalManyToManyField('blog.BlogCategory', blank=True)
    tags = ClusterTaggableManager(through='blog.BlogPageTag', blank=True)

    content_panels = Page.content_panels + [
        ImageChooserPanel('header_image'),
        MarkdownPanel("body"),
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        FieldPanel('tags'),
    ]

    @property
    def blog_page(self):
        return self.get_parent().specific

    def get_context(self, request, *args, **kwargs):
        context = super(PostPage, self).get_context(request, *args, **kwargs)
        context['blog_page'] = self.blog_page
        context['post'] = self
        return context
class PostPage(Page):
    body = MarkdownField()
    date = models.DateTimeField(verbose_name="Post date",
                                default=datetime.datetime.today)
    categories = ParentalManyToManyField('blog.BlogCategory', blank=True)
    tags = ClusterTaggableManager(through='blog.BlogPageTag', blank=True)

    content_panels = Page.content_panels + [
        MarkdownPanel('body'),
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        FieldPanel('tags'),
    ]

    settings_panels = Page.settings_panels + [
        FieldPanel('date'),
    ]

    @property
    def blog_page(self):
        return self.get_parent().specific

    def get_context(self, request, *args, **kwargs):
        context = super(PostPage, self).get_context(request, *args, **kwargs)
        context['blog_page'] = self.blog_page
        context['post'] = self
        return context
Esempio n. 5
0
class HireMe(TranslatablePage):
    Page = TranslatablePage
    banner = models.ForeignKey('wagtailimages.Image', on_delete=models.SET_NULL, related_name='+', blank=True, null=True)
    title_caption = models.CharField(max_length=80,blank=True)
    Flow = MarkdownField(blank=True) 
    Task = MarkdownField(blank=True)
    Plan = MarkdownField(blank=True)
    Charge = MarkdownField(blank=True)

    content_panels = Page.content_panels + [
        ImageChooserPanel('banner'),
        FieldPanel('title_caption'),
        MarkdownPanel('Flow'),
        MarkdownPanel('Task'),
        MarkdownPanel('Plan'),
        MarkdownPanel('Charge'),
    ]
Esempio n. 6
0
class PostPage(Page):
    excerpt = MarkdownField()
    featured = models.BooleanField(default=False)
    body = StreamField([
        ('image', ImageChooserBlock()),
        ('html', blocks.RawHTMLBlock()),
        ('embed', EmbedBlock()),
        ('paragraph', MarkdownBlock(icon="code")),
    ])
    date = models.DateTimeField(verbose_name="Post date",
                                default=datetime.datetime.today)

    header_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
    )
    header_image_link = models.CharField(max_length=255, blank=True)

    categories = ParentalManyToManyField('blog.BlogCategory', blank=True)
    tags = ClusterTaggableManager(through='blog.BlogPageTag', blank=True)

    content_panels = Page.content_panels + [
        StreamFieldPanel("body"),
        ImageChooserPanel('header_image'),
        FieldPanel('header_image_link'),
        FieldPanel('excerpt'),
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        #FieldPanel('tags'),
        FieldPanel('featured'),
    ]

    settings_panels = Page.settings_panels + [
        FieldPanel('date'),
    ]

    @property
    def blog_page(self):
        return self.get_parent().specific

    def get_context(self, request, *args, **kwargs):
        context = super(PostPage, self).get_context(request, *args, **kwargs)
        context['blog_page'] = self.blog_page
        context['post'] = self
        return context

    def get_absolute_url(self):
        return "/news/%s/" % self.slug
Esempio n. 7
0
class PostPage(BasePost):

    Page = TranslatablePage
    body = MarkdownField()

    content_panels = Page.content_panels + [
        ImageChooserPanel('thumbnail'),
        MarkdownPanel('body'),
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        PageChooserPanel(
            'related_page1',
            ['blog.PostPage', 'blog.LandingPage', 'blog.LandingPost']),
        PageChooserPanel(
            'related_page2',
            ['blog.PostPage', 'blog.LandingPage', 'blog.LandingPost']),
    ]

    settings_panels = Page.settings_panels + [
        FieldPanel('date'),
        MultiFieldPanel([
            FieldPanel('is_series'),
            FieldPanel('series_name'),
            FieldPanel('series_id')
        ],
                        heading='SeriesSetting',
                        classname="collapsible collapsed"),
    ]

    @property
    def blog_index(self):
        return self.get_parent().specific

    def get_context(self, request, *args, **kwargs):
        context = super().get_context(request, *args, **kwargs)
        context['blog_index'] = self.blog_index
        return context
Esempio n. 8
0
class HomePage(Page):
    body = MarkdownField()

    content_panels = Page.content_panels + [
        MarkdownPanel("body"),
    ]
Esempio n. 9
0
class PortfolioPage(Page):
    # Title Page
    name = models.CharField(
        max_length=150,
        blank=True,
    )
    phoneno = models.CharField(
        max_length=150,
        blank=True,
    )
    profile_image = models.ForeignKey('wagtailimages.Image',
                                      null=True,
                                      blank=True,
                                      on_delete=models.SET_NULL,
                                      related_name='+')
    designation = models.CharField(
        max_length=150,
        blank=True,
    )
    age = models.DateField(
        verbose_name="Date of Birth",
        blank=True,
    )
    email = models.EmailField(max_length=70, blank=True, unique=True)
    location = models.CharField(
        max_length=150,
        blank=True,
    )
    # Header Page
    header_title = models.CharField(
        max_length=150,
        blank=True,
    )
    header_content = MarkdownField(
        verbose_name='Header Content',
        blank=True,
    )
    resume_csv = models.ForeignKey('wagtaildocs.Document',
                                   null=True,
                                   blank=True,
                                   on_delete=models.SET_NULL,
                                   related_name='+')
    # Education Page
    resume_title = models.CharField(
        max_length=150,
        blank=True,
    )
    resume_content = MarkdownField(
        verbose_name='Resume Content',
        blank=True,
    )

    education_title = models.CharField(
        max_length=150,
        blank=True,
    )

    class EducationBlock(blocks.StructBlock):
        university = blocks.CharBlock(classname="full title")
        year_passing = blocks.CharBlock(classname="full title")
        education_content = blocks.CharBlock(classname="full title")

    education = StreamField([
        ('education', EducationBlock()),
    ],
                            null=True,
                            blank=True)

    #Employment Page
    employment_title = models.CharField(
        max_length=150,
        blank=True,
    )

    class EmploymentBlock(blocks.StructBlock):
        company_name = blocks.CharBlock(classname="full title")
        experience = blocks.CharBlock(classname="full title")
        designation = blocks.CharBlock(classname="full title")

    employment = StreamField([
        ('employment', EmploymentBlock()),
    ],
                             null=True,
                             blank=True)

    #Skills Page
    skills_title = models.CharField(
        max_length=150,
        blank=True,
    )

    class SkillsBlock(blocks.StructBlock):
        skills = blocks.CharBlock(classname="full title")
        percentage = blocks.CharBlock(classname="full title")

    skills = StreamField([
        ('skills', SkillsBlock()),
    ], null=True, blank=True)

    #Testimonials
    class TestimonialBlock(blocks.StructBlock):
        title = blocks.CharBlock(classname="full title")
        sub_title = blocks.CharBlock(classname="full title")
        content = blocks.RichTextBlock(blank=True)

    testimonial = StreamField([
        ('testimonial', TestimonialBlock()),
    ],
                              null=True,
                              blank=True)

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('name'),
            ImageChooserPanel('profile_image'),
            FieldPanel('phoneno'),
            FieldPanel('designation'),
            FieldPanel('age'),
            FieldPanel('email'),
            FieldPanel('location')
        ], "Heading"),
        MultiFieldPanel([
            FieldPanel('header_title'),
            MarkdownPanel('header_content'),
            DocumentChooserPanel('resume_csv'),
        ], "Header"),
        MultiFieldPanel([
            FieldPanel('resume_title'),
            MarkdownPanel('resume_content'),
            FieldPanel('education_title'),
            StreamFieldPanel('education'),
            FieldPanel('employment_title'),
            StreamFieldPanel('employment'),
            FieldPanel('skills_title'),
            StreamFieldPanel('skills'),
        ], "Resume"),
        MultiFieldPanel([
            StreamFieldPanel('testimonial'),
        ], "Testimonial"),
    ]

    def get_context(self, request, *args, **kwargs):
        context = super(PortfolioPage,
                        self).get_context(request, *args, **kwargs)
        context['portfolio'] = self
        context['posts'] = self.get_posts
        context['blog_page'] = self.get_blogs
        context['projects'] = self.get_projects
        context['parent_projects'] = self.get_parent_project
        context['gits'] = self.get_gits
        context['parent_gits'] = self.get_parent_git
        return context

    def get_posts(self):
        return PostPage.objects.live().order_by('date')[:6]

    def get_blogs(self):
        return BlogPage.objects.live().first()

    def get_projects(self):
        return ProjectPage.objects.live().order_by('?')[:3]

    def get_parent_project(self):
        return ProjectParentPage.objects.live().first()

    def get_gits(self):
        return GitPage.objects.live().order_by('?')[:3]

    def get_parent_git(self):
        return GitParentPage.objects.live().first()
Esempio n. 10
0
class PostPage(Page):
    body = MarkdownField()
    date = models.DateTimeField(verbose_name="Post date",
                                default=datetime.datetime.today)
    excerpt = MarkdownField(
        verbose_name='excerpt',
        blank=True,
    )

    header_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
    )

    categories = ParentalManyToManyField('blog.BlogCategory', blank=True)
    tags = ClusterTaggableManager(through='blog.BlogPageTag', blank=True)

    content_panels = Page.content_panels + [
        ImageChooserPanel('header_image'),
        MarkdownPanel("body"),
        MarkdownPanel("excerpt"),
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        FieldPanel('tags'),
    ]

    settings_panels = Page.settings_panels + [
        FieldPanel('date'),
    ]

    api_fields = (
        'header_image',
        APIField('header_image_url',
                 serializer=ImageRenditionField('original',
                                                source='header_image')),
        APIField('owner'),
        APIField('api_categories',
                 serializer=CategoryField(source='categories')),
        APIField('api_tags', serializer=TagField(source='tags')),
        APIField('pub_date',
                 serializer=DateTimeField(format='%d %B %Y', source='date')),
        APIField(
            'md_excerpt',
            serializer=MarkdownAPIField(source='excerpt'),
        ),
        APIField(
            'md_body',
            serializer=MarkdownAPIField(source='body'),
        ),
    )

    @property
    def blog_page(self):
        return self.get_parent().specific

    def get_context(self, request, *args, **kwargs):
        context = super(PostPage, self).get_context(request, *args, **kwargs)
        context['blog_page'] = self.blog_page
        context['post'] = self
        return context