Export a Django CMS page or a model view to a DOCX document
Project description
1 Django CMS Export Page
- Version:
0.2.4
- Source:
- Keywords:
django cms export docx
- PythonVersion:
3.11
Export a Django CMS page or a model view to a DOCX document
2 Features
Adds a menu entry in the CMS toolbar to export the current page
Ability to export a custom model, including placeholder fields
3 Installation
3.1 Requirements
Python 3.11 or above
Django 3.2 or above
Django CMS 4.1 or above
3.2 Install
pip install djangocms-export-page
4 Usage
In your Django settings:
INSTALLED_APPS = [
...
'djangocms_export_page',
...
]
4.1 CMS Page
CMS Page don’t need any extra configuration to work.
If a Plugin has a reverse ForeignKey that would behave like children, add the following to the CMSPlugin model class:
_export_page = {
'children': 'items'
}
@property
def items(self):
return self.frequentlyaskedquestion_set.all()
where items is a iterable attribute of the model class.
And for on the ForeignKey Django model class:
_export_page = {
'fields': ['name', ... ]
}
If you want to export the contents of a ForeignKey or OneToOneField inside the regular model you can use _export_page_field_names. Now these fields will be put in the some level as the plugin fields.
_export_page_field_names = ['number', 'title', 'lead', 'display_date', 'date', 'location']
4.2 Django Model
If you need to export a Django model included in a AppHook, add the following to the model class:
_export_page = {
'sections': [{
'name': 'Meta',
'fields': ['title', ... ]
}, {
'name': 'Body',
'fields': ['content']
}],
}
It’s better to put the PlaceholderField (here content) in a separate section.
4.3 Static Aliases
If you also want to export the static aliases of a page, some extra configuration is required. There is a setting called EXPORT_STATIC_ALIASES.
EXPORT_STATIC_ALIASES = {
'template_name': ['static_alias_code']
}
So with the cms settings it will look like this:
# test.html
<div>
{% static_alias 'test-placeholder' %}
</div>
# settings.py
CMS_TEMPLATES = [
('test.html', _('Test page')),
]
EXPORT_STATIC_ALIASES = {
'test.html': ['test-placeholder']
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djangocms_export_page-0.2.4.tar.gz.
File metadata
- Download URL: djangocms_export_page-0.2.4.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8279856288ccd4dd40ad2868606e282dc2464e6133db4d5dce29d371a7f99709
|
|
| MD5 |
8b448802a5f5a2e514c0d2c587bd5364
|
|
| BLAKE2b-256 |
d967fab09033e0158ca4acd38d64aa6fd945e798699f6a1105af719632f27bd6
|
Provenance
The following attestation bundles were made for djangocms_export_page-0.2.4.tar.gz:
Publisher:
ci.yml on maykinmedia/djangocms-export-page
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
djangocms_export_page-0.2.4.tar.gz -
Subject digest:
8279856288ccd4dd40ad2868606e282dc2464e6133db4d5dce29d371a7f99709 - Sigstore transparency entry: 529157682
- Sigstore integration time:
-
Permalink:
maykinmedia/djangocms-export-page@2d9c942fbd5a443d26cef51687b889ff164b4192 -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/maykinmedia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@2d9c942fbd5a443d26cef51687b889ff164b4192 -
Trigger Event:
push
-
Statement type:
File details
Details for the file djangocms_export_page-0.2.4-py3-none-any.whl.
File metadata
- Download URL: djangocms_export_page-0.2.4-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
512b65b4130c8badd0cd019b1c14c2c14913444576c9d527578092416f99e115
|
|
| MD5 |
4bf7dbb7e72814ffd8ceea2f176e57cb
|
|
| BLAKE2b-256 |
d556be2cb9f3f5d868f9e00acf0ec062d96fd9db2bc9d75d9dfb93bada1fd4b3
|
Provenance
The following attestation bundles were made for djangocms_export_page-0.2.4-py3-none-any.whl:
Publisher:
ci.yml on maykinmedia/djangocms-export-page
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
djangocms_export_page-0.2.4-py3-none-any.whl -
Subject digest:
512b65b4130c8badd0cd019b1c14c2c14913444576c9d527578092416f99e115 - Sigstore transparency entry: 529157686
- Sigstore integration time:
-
Permalink:
maykinmedia/djangocms-export-page@2d9c942fbd5a443d26cef51687b889ff164b4192 -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/maykinmedia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@2d9c942fbd5a443d26cef51687b889ff164b4192 -
Trigger Event:
push
-
Statement type: