django-cms / djangocms-versioning

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

Refactor get_title_obj in django-cms #212

Open jonathan-s opened 4 years ago

jonathan-s commented 4 years ago

When using django-cms together with versioning it's important to keep apart content/objects that should be displayed to the end user and content/objects that can be viewed by an admin user.

get_title_obj is used in several places to assign the object both in toolbars (admin related) and in places that will render to the end user.

There has been a lot of monkeypatching going on in djangocms-versioning to account for this fact. By creating a method get_admin_title_obj this method alone could be monkeypatched instead of spreading out the monkeypatching. If/when versioning is incorporated into core it would also make things easier to incorporate any monkeypatches into this method.

This will also start to setup us up for a clean separation between what is viewable by admin users and what is viewable by end users.

This is also related to the following PR > https://github.com/divio/django-cms/pull/6817 instead of that implementation it would be better if it used get_admin_title_obj

jonathan-s commented 4 years ago

Current WIP for this can be found here https://github.com/divio/djangocms-versioning/pull/214