google-code-export / django-page-cms

Automatically exported from code.google.com/p/django-page-cms
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Lack of django.conf.settings.PAGE_TEMPLATES leads to template error in admin #204

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Install and configure as in 
http://packages.python.org/django-page-cms/installation.html, but do not 
provide "PAGE_TEMPLATES" in project's settings.py (supposed to be optional)
2.  Do your syncdb and crank up the development server.
3.  Attempt to create your first page in the admin.

What is the expected output? What do you see instead?

I expect the normal page add form.

I get a template syntax error that's really a case of too many values to 
unpack, in:

       for option_value, option_label in chain(self.choices, choices):

in django/forms/widgets.py, (line 451 in django 1.2.1), render_options in a 
Select widget.

This is because self.choices is:

   (('pages/index.html', 'Default template'), 'pages/index.html',)

('pages/index.html' is the value of PAGE_DEFAULT_TEMPLATE.)

This, in turn, is because pages.settings.get_page_templates() returns:

   ('pages/index.html',)

That is because pages/settings.py contains:

    PAGE_TEMPLATES = get_setting('PAGE_TEMPLATES',
        default_value=(PAGE_DEFAULT_TEMPLATE,))

What you really want, I presume, is:

    PAGE_TEMPLATES = get_setting('PAGE_TEMPLATES',
        default_value=((PAGE_DEFAULT_TEMPLATE,),))

Or maybe better:

    PAGE_TEMPLATES = get_setting('PAGE_TEMPLATES',
        default_value=())

Anyway, a work around for me is to set PAGE_TEMPLATES = () in my
project level settings.py .

Are you using the master version or a released version of this CMS on the
github repository?

I used the master requirements to install with pip.  It looks to be 1.1.3 .

If you can write a test that reproduce the problem, there is better chance
it will be resolved quickly.

Just comment out the PAGE_TEMPLATES setting in your project's settings.py and 
you will probably see it.

Original issue reported on code.google.com by ke1g...@gmail.com on 23 Jun 2010 at 10:19

GoogleCodeExporter commented 9 years ago
Thanks for the detailed issue and solution. The commit is there:

http://github.com/batiste/django-page-cms/commit/d0b622492bef0070e0c931714c22efd
33f4ddd84

Original comment by batiste....@gmail.com on 28 Jun 2010 at 7:45