Merge pull request #261 from krukas/master

[BUGFIX] #255 Fixed MySQL tests failing mysql + admin context
This commit is contained in:
Dave Hall 2019-11-01 10:26:22 +00:00 committed by GitHub
commit fc0774ddad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -5,7 +5,12 @@ from optparse import OptionParser
AVAILABLE_DATABASES = {
'psql': {'ENGINE': 'django.db.backends.postgresql_psycopg2'},
'mysql': {'ENGINE': 'django.db.backends.mysql'},
'mysql': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"
},
},
'sqlite': {'ENGINE': 'django.db.backends.sqlite3'},
}
@ -103,7 +108,10 @@ def main():
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth']},
'OPTIONS': {'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
]},
'APP_DIRS': True,
}],
)

View file

@ -17,8 +17,8 @@ from watson.models import SearchEntry, has_int_pk
def regex_from_word(word):
"""Generates a regext from the given search word."""
return "(\s{word})|(^{word})".format(
"""Generates a regex from the given search word."""
return r"(\s{word})|(^{word})".format(
word=re.escape(word),
)