votes up 1

Invalid collation name: %r.

Package:
django
github stars 59414
Exception Class:
ValueError

Raise code

    function = 'COLLATE'
    template = '%(expressions)s %(function)s %(collation)s'
    # Inspired from https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
    collation_re = _lazy_re_compile(r'^[\w\-]+$')

    def __init__(self, expression, collation):
        if not (collation and self.collation_re.match(collation)):
            raise ValueError('Invalid collation name: %r.' % collation)
        self.collation = collation
        super().__init__(expression)

    def as_sql(self, compiler, connection, **extra_context):
        extra_context.setdefault('collation', connection.ops.quote_name(self.collation))
        return super().as_sql(compiler, connection, **extra_context)
😲  Walkingbet is Android app that pays you real bitcoins for a walking. Withdrawable real money bonus is available now, hurry up! 🚶

NO FIXES YET

Just press the button and we will add solution
to this exception as soon as possible

* As many users press the button, the faster we create a fix

Add a possible fix

Please authorize to post fix