Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

CouchDbKit Django ext does not work with choices #110

sirex opened this Issue Nov 12, 2011 · 3 comments


None yet
4 participants

sirex commented Nov 12, 2011

Here is a code example::

# models.py

from couchdbkit.ext.django import schema

    ('gpl', _('GPL')),
    ('lgpl', _('LGPL')),
    ('bsd', _('BSD')),

class Work(schema.Document):
    licence = schema.StringProperty(_('Licence'),
            required=True, default='gpl', choices=LICENCE_CHOICES)

# forms.py

from couchdbkit.ext.django.forms import DocumentForm

from .models import Work

class WorkForm(DocumentForm):
    class Meta:
        document = Work

When I try to render this form, I get this error::

Error when calling the metaclass bases
    cannot concatenate 'str' and 'list' objects

Exception Location: .../couchdbkit/ext/django/forms.py in
                                fields_for_document, line 160

This error is caused by this code::

if prop.choices:
    if prop.default:
        defaults['choices'] = prop.default_value() + list(
        defaults['coerce'] = prop.to_python

My default value is 'gpl', why default value is concatenated with choices? Is
this an error or a feature which I don't know how to use?

hassa commented Jun 20, 2012

+1 we have the exact same issue and were wondering if it is a feature we are misusing or if we are doing something wrong with the original choices.

pagles commented Jun 20, 2012

Same here wondering if this is this an error or a feature.


Is there any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment