-
-
Notifications
You must be signed in to change notification settings - Fork 333
feat: Add management command to load demo content #74
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mrbazzan ! I will give it a test run in the coming days. A few thoughts:
- Is it possible to rename the folder to "democontent" to be consistent with the command?
- Can the command list the options (i.e. files in the democontent folder) if you do not specify any?
- If only a file name and no path is specified, can the command automatically read from the democontent folder?
- Another option would be to call the new page "help-2" if "help" already existed.
#TODO: delete possible after whole operation? | ||
username = "demo" | ||
password = "demo" | ||
user = User.objects.create_user(username=username, password=password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not suffice. The user will need to be a staff user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. It creates the page as a normal user.
Could you please explain why it should be a staff user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this in order to use the same user to access the admin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you only need the user to create the page, you can give it an invalid password, which you do. So that's all right! Maybe just a get_or_create?
Hi @fsbraun, won't that cluster the page tree? |
Alternatively, to avoid unintended clustering, you can add a |
from djangocms_transfer.datastructures import ArchivedPlaceholder, ArchivedPlugin | ||
|
||
|
||
LANGUAGE="en" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the code via ruff check filename.py
LANGUAGE = "en"
return ArchivedPlugin(**data) | ||
return data | ||
|
||
fixture = abs_filepath.open() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to try this:
data = f.read()
#do something with data```
This pull request address issue #73 .
It adds a management command to load data exported using
djangocms-transfer
.It works by running
docker compose --rm web python manage.py democontent demo-content/help.json
.I would like to remove the FILE positional argument from the command so it becomes
docker compose --rm web python manage.py democontent
but we would need to finalise the content thatwould be in the remote URI (which we would then use internally).