Search code examples
pythondjangodjango-cmsdivio

aldryn django-cms adding template


How do I add custom created template, so user can choose it? I want user to be able to select template services.html

I have project running locally. I am awere that with Aldryn desktop app I can add template. But then it's being added to cloud version, and to have it locally I need pull from cloud (which destroys my local changes).

I want to develop locally, and then everything push to cloud.


Solution

  • For a standalone django CMS project, you can define your custom templates inside your settings.py by adding/extending the CMS_TEMPLATES variable.

    Example:

    CMS_TEMPLATES = (
        ('base.html', gettext('default')),
        ('2col.html', gettext('2 Column')),
        ('3col.html', gettext('3 Column')),
        ('extra.html', gettext('Some extra fancy template')),
    )
    

    See also http://docs.django-cms.org/en/develop/reference/configuration.html#cms-templates

    Note that if you work on Aldryn, the templates have to be defined with the "Aldryn Desktop App", since this setting is currently not getting read from the settings.py (this will be addressed soon).

    However in your case, you could define the templates with the Desktop App, do a git pull locally and then insert your changes. After you're done with development (locally), simply commit and push the changes to your test server again and it should be available there too.

    Full disclosure: I work for Divio/Aldryn.