Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render footnotes generated in richtextblock #47

Open
DBonbon opened this issue Jan 12, 2023 · 1 comment
Open

render footnotes generated in richtextblock #47

DBonbon opened this issue Jan 12, 2023 · 1 comment

Comments

@DBonbon
Copy link

DBonbon commented Jan 12, 2023

How to name/ refer to footnotes in a block
In models.py I can generate footnotes as expected. Yet, if I use the same block it doesn't render the note. That is, I create and populates the notes in Admin, in the template they appear with the Admin with system's ref, and the footnotes section is empty - {% include "wagtail_footnotes/includes/footnotes.html" %}.

class Notes1Page(Page):
    body = StreamField([
        ('fnotes', RichTextBlockWithFootnotes(label=("Feature type"), blank=True, default='abc',)),
    ])    ...

    content_panels = Page.content_panels + [
        FieldPanel('body', classname='full'),        ...
    ]

this above works, but the below doesn't:

class ColumnBlock(blocks.StreamBlock):

    paragraph = blocks.wagtail_footnotes.blocks.RichTextBlockWithFootnotes(editor='full', label='Paragraphe') 
    # error: 'wagtail.core.blocks' has no attribute 'wagtail_footnotes'
    paragraph1 = blocks.RichTextBlock(editor='full', label='Paragraphe')    #full' is defined in WAGTAILADMIN_RICH_TEXT_EDITORS/base.py, 
    paragraph2 = blocks.RichTextBlock(features=["bold", "italic", "link", "footnotes"], required=False, label='Paragraphe2') 
    
    paragraph3 = RichTextBlockWithFootnotes(features=["bold", "italic", "footnotes"], required=False, label='Paragraphe Notes1')
#Paragraph1-3 generate footnotes in the Admin, but don't render them in the template.
    ...
@nimasmi
Copy link

nimasmi commented Jan 16, 2023

Hi @DBonbon. I see the reference to blocks.wagtail_footnotes.blocks.RichTextBlockWithFootnotes. This should be wagtail_footnotes.blocks.RichTextBlockWithFootnotes, and you will need to have imported wagtail_footnotes.

I am unclear about what else you are describing, but I hope the change above is enough to help you resolve this. If you have further issues after this, please update the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants