CouchDbKit Django ext does not work with choices
- Dominant language
- Python
- Stars
- 263
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Here is a code example::
```
# models.py
from couchdbkit.ext.django import schema
LICENCE_CHOICES = (
('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(
prop.choices)
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?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.