Better more explicit

This commit is contained in:
Pablo Martín 2014-10-13 19:57:40 +02:00
parent 5009091673
commit c232d1776c
3 changed files with 4 additions and 4 deletions

View File

@ -200,7 +200,7 @@ LOGGING = {
import django import django
if django.VERSION[0] >= 1 and django.VERSION[1] >= 4: if django.VERSION[0] == 1 and django.VERSION[1] >= 4:
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.tz',) TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.tz',)
LOGGING['filters'] = { LOGGING['filters'] = {
'require_debug_false': { 'require_debug_false': {

View File

@ -30,11 +30,11 @@ if len(sys.argv) == 1:
else: else:
os.environ[ENVIRONMENT_VARIABLE] = sys.argv[1] os.environ[ENVIRONMENT_VARIABLE] = sys.argv[1]
if django.VERSION[0] >= 1 and django.VERSION[1] >= 7: if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
application = get_wsgi_application() application = get_wsgi_application()
if django.VERSION[0] >= 1 and django.VERSION[1] <= 5: if django.VERSION[0] == 1 and django.VERSION[1] <= 5:
management.call_command('test', 'app') management.call_command('test', 'app')
else: else:
management.call_command('test', 'example.app') management.call_command('test', 'example.app')

View File

@ -78,7 +78,7 @@ class MultiSelectField(models.CharField):
arr_choices = self.get_choices_selected(self.get_choices_default()) arr_choices = self.get_choices_selected(self.get_choices_default())
for opt_select in value: for opt_select in value:
if (opt_select not in arr_choices): if (opt_select not in arr_choices):
if django.VERSION[0] >= 1 and django.VERSION[1] >= 6: if django.VERSION[0] == 1 and django.VERSION[1] >= 6:
raise exceptions.ValidationError(self.error_messages['invalid_choice'] % {"value": value}) raise exceptions.ValidationError(self.error_messages['invalid_choice'] % {"value": value})
else: else:
raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value) raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value)