wagtail_word
============
A Wagtail module to display Word documents in the frontend.
Converts your word documents to richtext for easy editing in the Wagtail admin.
**Currently supported filetypes:**
- .docx
- .doc
**Currently supported content:**
- Text (Bold, underlines, italic, strikethrough)
- Text suports colors with allow_styling=True
- Colors get reset after saving the page in Wagtail admin for a second time.
- Images
- Tables
- Hyperlinks
- Lists
- All will be converted to bullet points
- Single level lists only
Quick start
-----------
1. Add 'wagtail_word' to your INSTALLED_APPS setting like this:
```
INSTALLED_APPS = [
...,
'wagtail_word',
]
```
2. Simply go to your Wagtail Admin.
3. Create a new Word Page.
4. Upload a file in the File field.
5. Save or publish the page and see the magic!
Base Class
-----------
We provide a base class to extend from. This class will provide you a predefined FieldPanel for the File, has the allow_styling attribute and a custom method to set the content to the right field for you to override.
```python
# Example class
class WordDocumentPage(BaseWordDocumentPage):
template = 'wagtail_word/page.html'
content = RichTextField(
blank=True,
null=True,
features=[
# Minimal required features for richtext
"h1", "h2", "h3", "h4", "h5", "h6",
"bold", "italic", "ol", "ul", "link" "image", "embed",
"blockquote",
]
)
edit_panels = [
FieldPanel('content'),
]
edit_handler = TabbedInterface([
ObjectList(BaseWordDocumentPage.content_panels, heading=_('Upload')),
ObjectList(edit_panels, heading=_('Edit')),
...
])
# Override this method to set the content to the right field
def set_content(self, content: str):
self.content = content
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Nigel2392/wagtail_word",
"name": "wagtail-word",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Nigel",
"author_email": "nigel@goodadvice.it",
"download_url": "https://files.pythonhosted.org/packages/ec/f7/d04308761af9e8544e557ed8a5a2256e6f0baba17df52e5b201e801dddfb/wagtail_word-1.1.3.tar.gz",
"platform": null,
"description": "wagtail_word\r\n============\r\n\r\nA Wagtail module to display Word documents in the frontend.\r\nConverts your word documents to richtext for easy editing in the Wagtail admin.\r\n\r\n**Currently supported filetypes:**\r\n- .docx\r\n- .doc\r\n\r\n**Currently supported content:**\r\n- Text (Bold, underlines, italic, strikethrough)\r\n - Text suports colors with allow_styling=True\r\n - Colors get reset after saving the page in Wagtail admin for a second time.\r\n- Images\r\n- Tables\r\n- Hyperlinks\r\n- Lists\r\n - All will be converted to bullet points\r\n - Single level lists only\r\n\r\nQuick start\r\n-----------\r\n\r\n1. Add 'wagtail_word' to your INSTALLED_APPS setting like this:\r\n\r\n ```\r\n INSTALLED_APPS = [\r\n ...,\r\n 'wagtail_word',\r\n ]\r\n ```\r\n2. Simply go to your Wagtail Admin.\r\n3. Create a new Word Page.\r\n4. Upload a file in the File field.\r\n5. Save or publish the page and see the magic!\r\n\r\nBase Class\r\n-----------\r\nWe provide a base class to extend from. This class will provide you a predefined FieldPanel for the File, has the allow_styling attribute and a custom method to set the content to the right field for you to override.\r\n\r\n```python\r\n# Example class\r\nclass WordDocumentPage(BaseWordDocumentPage):\r\n template = 'wagtail_word/page.html'\r\n\r\n content = RichTextField(\r\n blank=True,\r\n null=True,\r\n features=[\r\n # Minimal required features for richtext\r\n \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \r\n \"bold\", \"italic\", \"ol\", \"ul\", \"link\" \"image\", \"embed\", \r\n \"blockquote\",\r\n ]\r\n )\r\n\r\n edit_panels = [\r\n FieldPanel('content'),\r\n ]\r\n\r\n edit_handler = TabbedInterface([\r\n ObjectList(BaseWordDocumentPage.content_panels, heading=_('Upload')),\r\n ObjectList(edit_panels, heading=_('Edit')),\r\n ...\r\n ])\r\n \r\n # Override this method to set the content to the right field\r\n def set_content(self, content: str):\r\n self.content = content\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "Easily upload your word documents to Wagtail as pages",
"version": "1.1.3",
"project_urls": {
"Homepage": "https://github.com/Nigel2392/wagtail_word"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ecf7d04308761af9e8544e557ed8a5a2256e6f0baba17df52e5b201e801dddfb",
"md5": "6c276d9ac959cb14cfe1b62b85228c6c",
"sha256": "a014fbc72d4a480278f301cfde37a482d10ba15a25b0c98ebf7fc920ff7328ab"
},
"downloads": -1,
"filename": "wagtail_word-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "6c276d9ac959cb14cfe1b62b85228c6c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 21462,
"upload_time": "2024-02-22T08:41:25",
"upload_time_iso_8601": "2024-02-22T08:41:25.980404Z",
"url": "https://files.pythonhosted.org/packages/ec/f7/d04308761af9e8544e557ed8a5a2256e6f0baba17df52e5b201e801dddfb/wagtail_word-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-22 08:41:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Nigel2392",
"github_project": "wagtail_word",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "wagtail-word"
}