django-cms / djangocms-versioning

General purpose versioning package for Django CMS 4 and above.
Other
33 stars 29 forks source link

feat: Add management command to create version objects #304

Closed fsbraun closed 1 year ago

fsbraun commented 1 year ago

Description

This PR adds a management command to create (usually draft) Version objects for versioned content that lacks a Version object. This is relevant if one adds versioning to a project after unversioned content has been created.

usage: manage.py create_versions [-h]
                                 [--state {draft,published,archived}]
                                 [--username USERNAME] [--userid USERID]
                                 [--dry-run] [--version] [-v {0,1,2,3}]
                                 [--settings SETTINGS]
                                 [--pythonpath PYTHONPATH] [--traceback]
                                 [--no-color] [--force-color] [--skip-checks]

Creates Version objects for versioned models lacking one. If the
DJANGOCMS_VERSIONING_DEFAULT_USER setting is not populated you will have to
provide either the --userid or --username option for each Version object
needs to be assigned to a user.

optional arguments:
  -h, --help            show this help message and exit
  --state {draft,published,archived}
                        state of newly created version object (defaults to
                        draft)
  --username USERNAME   Username of user to create the missing Version
                        objects
  --userid USERID       User id of user to create the missing Version objects
  --dry-run             Do not change the database

Related resources

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #304 (46daead) into master (e880798) will increase coverage by 0.12%. The diff coverage is 95.65%.

@@            Coverage Diff             @@
##           master     #304      +/-   ##
==========================================
+ Coverage   89.75%   89.87%   +0.12%     
==========================================
  Files          67       68       +1     
  Lines        2196     2242      +46     
  Branches      293      299       +6     
==========================================
+ Hits         1971     2015      +44     
- Misses        170      172       +2     
  Partials       55       55              
Impacted Files Coverage Δ
..._versioning/management/commands/create_versions.py 95.55% <95.55%> (ø)
djangocms_versioning/conf.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.