Package release
ocyan-plugin-demo-data
mandel/testing ยท Version 1.2.5rc1
Provides basic sample content and fixture registration for Ocyan sites.
Metadata
| author | MandelBlogStack |
|---|---|
| classifiers |
|
| description_content_type | text/markdown |
| license | Proprietary |
| metadata_version | 2.5 |
| provides_extras |
|
| requires_dist |
|
| requires_python | <3.14,>=3.12 |
Release files
| File | Test results | History |
|---|---|---|
ocyan_plugin_demo_data-1.2.5rc1-py3-none-any.whl
|
|
|
ocyan_plugin_demo_data-1.2.5rc1.tar.gz
|
|
Ocyan plugin demo data
Installation
Add ocyan.plugin.demo_data to your projects dependencies.
Description
This plugin installs basic content into the website. Each plugin contains their own demo data, which will be aggregated and installed in the project.
Demodata fixtures will only be installed ONCE a record is kept in the database of the installed demodata fixtures. This is needed, because if we would install the fixtures each time, it would overwrite any modifications done in the database.
The demodata fixture record can be found here:
http://127.0.0.1:8000/manage/ocyan_plugin_demo_data/demodatafixture/
By deleting a record, you can force the fixture to be installed again. This can be useful, when installing a new plugin that overrides fixtures of a plugin allready installed.
Usage
Demo data consists of a name, a fixture and optionally a priority. Plugins can
register fixtures under a certain key and override the fixtures registered by
other plugins by speififying a priority.
An example of a plugin registering demodata by using fixtures:
def contribute_to_fixtures(self, fixtures):
fixtures.add("data", "plugin/data")
fixtures.add("wagtailhome", "superhome/home", 7) # with high priority 7
return fixtures
Signals
The demodata plugin sends 2 signals, to which plugins can respond to perform additional actions, like copying images or creating data that is more dynamic than can be stored in a fixture.
django.core.signals.pre_loaddemodataproviding_args=["has_unloaded_fixtures"]django.core.signals.post_loaddemodataproviding_args=["has_unloaded_fixtures"]
The has_unloaded_fixtures argument designates if there are any fixtures that
will be loaded this run. Use that argument for tasks that shpuld not run
every time the demodata is loaded, only when actual loading is being performed.
Install the demodata
While the demodata will usually be installed into the project automatically, you can run it manually also. To manually run the demo data installation, run
manage.py loaddemodata