Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django.db.utils.ProgrammingError: operator class "text_pattern_ops" does not accept data type text[] #57

Open
luminousmen opened this issue Jan 26, 2017 · 0 comments

Comments

@luminousmen
Copy link

luminousmen commented Jan 26, 2017

In our development we are using django==1.8.2 and we have this strange problem on initial migrations. To be more specific the fields.py:

class LanguagesField(TextArrayField):
    def __init__(self, *args, **kwargs):
        kwargs.update({
            'verbose_name': _('языковые версии'),
            'choices': settings.LANGUAGES,
            'default': ('en',),
            'db_index': True
        })

        super(LanguagesField, self).__init__(*args, **kwargs)

    def formfield(self, **kwargs):
        kwargs['widget'] = forms.CheckboxSelectMultiple(attrs={'class': 'uioff'})
        kwargs['required'] = True

        return super(LanguagesField, self).formfield(**kwargs)

In models.py:

langs = LanguagesField()

The initial migration:

fields = [
...

('langs', multilanguages.fields.LanguagesField(default=('en',), choices=[(b'en', '\u0410\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439'), (b'ru', '\u0420\u0443\u0441\u0441\u043a\u0438\u0439'), (b'tr', '\u0422\u0443\u0440\u0435\u0446\u043a\u0438\u0439')], dbtype='text', verbose_name='\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438', db_index=True)),
...
]

And error on ./manage.py migrate

django.db.utils.ProgrammingError: operator class "text_pattern_ops" does not accept data type text[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant