Skip to content

Commit e702490

Browse files
committed
Small fixes for Django 1.7, also cosmetic changes and typo fixes
1 parent 9dfc314 commit e702490

File tree

6 files changed

+9
-22
lines changed

6 files changed

+9
-22
lines changed

bootstrap3/renderers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def parse_size(self, size):
5353
return 'large'
5454
if size in ('md', 'medium', ''):
5555
return 'medium'
56-
raise BootstrapError('Invalid value "%s" for parameter "size".' % size)
56+
raise BootstrapError('Invalid value "%s" for parameter "size" (expected "sm", "md", "lg" or "").' % size)
5757

5858
def get_size_class(self, prefix='input'):
5959
if self.size == 'small':

bootstrap3/tests.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
from __future__ import unicode_literals
33

44
import re
5+
from unittest import TestCase
56

67
from django import forms
78
from django.template import Template, Context
8-
from django.utils.unittest import TestCase
9-
from bootstrap3.text import text_value, text_concat
109

10+
from .text import text_value, text_concat
1111
from .exceptions import BootstrapError
12-
1312
from .html import add_css_class
1413

1514

demo/demo/settings.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
import os
55
import sys
66

7-
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
7+
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
88

99
# Include BOOTSTRAP3_FOLDER in path
10-
BOOTSTRAP3_FOLDER = os.path.abspath(os.path.join(PROJECT_ROOT, '..', 'bootstrap3'))
10+
BOOTSTRAP3_FOLDER = os.path.abspath(os.path.join(BASE_DIR, '..', 'bootstrap3'))
1111
if BOOTSTRAP3_FOLDER not in sys.path:
1212
sys.path.insert(0, BOOTSTRAP3_FOLDER)
1313

1414
DEBUG = True
1515
TEMPLATE_DEBUG = DEBUG
1616

1717
ADMINS = ()
18-
MANAGERS = ADMINS
1918

2019
DATABASES = {
2120
'default': {
@@ -38,8 +37,6 @@
3837
# http://www.i18nguy.com/unicode/language-identifiers.html
3938
LANGUAGE_CODE = 'en-us'
4039

41-
SITE_ID = 1
42-
4340
# If you set this to False, Django will make some optimizations so as not
4441
# to load the internationalization machinery.
4542
USE_I18N = True
@@ -82,27 +79,19 @@
8279
STATICFILES_FINDERS = (
8380
'django.contrib.staticfiles.finders.FileSystemFinder',
8481
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
85-
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
82+
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
8683
)
8784

8885
# Make this unique, and don't share it with anybody.
8986
SECRET_KEY = '8s)l4^2s&&0*31-)+6lethmfy3#r1egh^6y^=b9@g!q63r649_'
9087

91-
# List of callables that know how to import templates from various sources.
92-
TEMPLATE_LOADERS = (
93-
'django.template.loaders.filesystem.Loader',
94-
'django.template.loaders.app_directories.Loader',
95-
# 'django.template.loaders.eggs.Loader',
96-
)
97-
9888
MIDDLEWARE_CLASSES = (
9989
'django.middleware.common.CommonMiddleware',
10090
'django.contrib.sessions.middleware.SessionMiddleware',
10191
'django.middleware.csrf.CsrfViewMiddleware',
10292
'django.contrib.auth.middleware.AuthenticationMiddleware',
10393
'django.contrib.messages.middleware.MessageMiddleware',
104-
# Uncomment the next line for simple clickjacking protection:
105-
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
94+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
10695
)
10796

10897
ROOT_URLCONF = 'demo.urls'

demo/demo/templates/demo/form_by_field.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<form role="form" method="post">
1212
{% csrf_token %}
1313
{% bootstrap_form_errors form type='non_fields' %}
14-
{% bootstrap_field form.subject layout='horizontal' %}
14+
{% bootstrap_field form.subject layout='horizontal' size='sm' %}
1515
{% buttons submit='OK' reset="Cancel" %}{% endbuttons %}
1616
</form>
1717

docs/settings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The ``BOOTSTRAP3`` dict variable is contains these settings and defaults:
3838
# Label class to use in horizontal forms
3939
'horizontal_label_class': 'col-md-2',
4040
41-
# Field class to use in horiozntal forms
41+
# Field class to use in horizontal forms
4242
'horizontal_field_class': 'col-md-4',
4343
4444
# Set HTML required attribute on required fields

testsettings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
SECRET_KEY = 'bootstrap3isawesome'
55

6-
76
DATABASES = {
87
'default': {
98
'ENGINE': 'django.db.backends.sqlite3',

0 commit comments

Comments
 (0)