Merge branch 'fix-tests' of https://github.com/nikolas/django-bootstrap-form into nikolas-fix-tests

Conflicts:
	bootstrapform/fixtures/basic.html
	bootstrapform/fixtures/horizontal.html
	tests/test_settings.py
This commit is contained in:
tzangms 2015-03-09 14:42:25 +00:00
commit 86a79783ed
5 changed files with 194 additions and 356 deletions

View File

@ -1,210 +1,99 @@
<div class="form-group">
<label class="control-label " for="id_char_field">Char field</label>
<div class=" ">
<input class=" form-control" id="id_char_field" name="char_field" type="text" />
</div>
<label class="control-label " for="id_char_field">Char field</label>
<div class=" ">
<input class=" form-control" id="id_char_field" name="char_field" type="text" />
</div>
</div>
<div class="form-group">
<label class="control-label " for="id_choice_field">Choice field</label>
<div class=" ">
<select class=" form-control" id="id_choice_field" name="choice_field">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
<label class="control-label " for="id_choice_field">Choice field</label>
<div class=" ">
<select class=" form-control" id="id_choice_field" name="choice_field">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label ">Radio choice</label>
<div class="">
<div class="radio">
<label>
<input id="id_radio_choice_0" name="radio_choice" type="radio" value="0" />
Zero
</label>
</div>
<div class="radio">
<label>
<input id="id_radio_choice_1" name="radio_choice" type="radio" value="1" />
One
</label>
</div>
<div class="radio">
<label>
<input id="id_radio_choice_2" name="radio_choice" type="radio" value="2" />
Two
</label>
</div>
<label class="control-label ">Radio choice</label>
<div class="">
<div class="radio">
<label>
<input id="id_radio_choice_0" name="radio_choice" type="radio" value="0" />
Zero
</label>
</div>
</div>
<div class="form-group">
<label class="control-label " for="id_multiple_choice">Multiple choice</label>
<div class=" ">
<select multiple="multiple" class=" form-control" id="id_multiple_choice" name="multiple_choice">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
<div class="radio">
<label>
<input id="id_radio_choice_1" name="radio_choice" type="radio" value="1" />
One
</label>
</div>
<div class="radio">
<label>
<input id="id_radio_choice_2" name="radio_choice" type="radio" value="2" />
Two
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label " for="id_multiple_checkbox">Multiple checkbox</label>
<div class=" multiple-checkbox">
<ul id="id_multiple_checkbox">
<li><label for="id_multiple_checkbox_0"><input id="id_multiple_checkbox_0" name="multiple_checkbox" type="checkbox" value="0" /> Zero</label></li>
<li><label for="id_multiple_checkbox_1"><input id="id_multiple_checkbox_1" name="multiple_checkbox" type="checkbox" value="1" /> One</label></li>
<li><label for="id_multiple_checkbox_2"><input id="id_multiple_checkbox_2" name="multiple_checkbox" type="checkbox" value="2" /> Two</label></li>
</ul>
</div>
<label class="control-label " for="id_multiple_choice">Multiple choice</label>
<div class=" ">
<select multiple="multiple" class=" form-control" id="id_multiple_choice" name="multiple_choice">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label " for="id_file_fied">File fied</label>
<div class=" ">
<input id="id_file_fied" name="file_fied" type="file" />
</div>
<label class="control-label " for="id_multiple_checkbox">Multiple checkbox</label>
<div class=" multiple-checkbox">
<ul id="id_multiple_checkbox">
<li><label for="id_multiple_checkbox_0"><input id="id_multiple_checkbox_0" name="multiple_checkbox" type="checkbox" value="0" /> Zero</label></li>
<li><label for="id_multiple_checkbox_1"><input id="id_multiple_checkbox_1" name="multiple_checkbox" type="checkbox" value="1" /> One</label></li>
<li><label for="id_multiple_checkbox_2"><input id="id_multiple_checkbox_2" name="multiple_checkbox" type="checkbox" value="2" /> Two</label></li>
</ul>
</div>
</div>
<div class="form-group">
<label class="control-label " for="id_file_fied">File fied</label>
<label class="control-label " for="id_password_field">Password field</label>
<div class=" ">
<input class=" form-control" id="id_password_field" name="password_field" type="password" />
</div>
<div class=" ">
<input id="id_file_fied" name="file_fied" type="file" />
</div>
</div>
<div class="form-group">
<label class="control-label " for="id_password_field">Password field</label>
<label class="control-label " for="id_textarea">Textarea</label>
<div class=" ">
<textarea class=" form-control" cols="40" id="id_textarea" name="textarea" rows="10">
</textarea>
</div>
<div class=" ">
<input class=" form-control" id="id_password_field" name="password_field" type="password" />
</div>
</div>
<div class="form-group">
<div class="">
<div class="checkbox">
<label >
<input id="id_boolean_field" name="boolean_field" type="checkbox" /> <span>Boolean field</span>
</label>
</div>
</div>
<label class="control-label " for="id_textarea">Textarea</label>
<div class=" ">
<textarea class=" form-control" cols="40" id="id_textarea" name="textarea" rows="10">
</textarea>
</div>
</div>
<div class="form-group">
<div class="">
<div class="checkbox">
<label >
<input id="id_boolean_field" name="boolean_field" type="checkbox" /> <span>Boolean field</span>
</label>
</div>
</div>
</div>

View File

@ -1,210 +1,102 @@
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 " for="id_char_field">Char field</label>
<label class="control-label col-sm-2 col-lg-2 " for="id_char_field">Char field</label>
<div class=" col-sm-10 col-lg-10 ">
<input class=" form-control" id="id_char_field" name="char_field" type="text" />
</div>
<div class=" col-sm-10 col-lg-10 ">
<input class=" form-control" id="id_char_field" name="char_field" type="text" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 " for="id_choice_field">Choice field</label>
<label class="control-label col-sm-2 col-lg-2 " for="id_choice_field">Choice field</label>
<div class=" col-sm-10 col-lg-10 ">
<select class=" form-control" id="id_choice_field" name="choice_field">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
<div class=" col-sm-10 col-lg-10 ">
<select class=" form-control" id="id_choice_field" name="choice_field">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 ">Radio choice</label>
<label class="control-label col-sm-2 col-lg-2 ">Radio choice</label>
<div class=" col-sm-10 col-lg-10">
<div class="radio">
<label>
<input id="id_radio_choice_0" name="radio_choice" type="radio" value="0" />
Zero
</label>
</div>
<div class="radio">
<label>
<input id="id_radio_choice_1" name="radio_choice" type="radio" value="1" />
One
</label>
</div>
<div class="radio">
<label>
<input id="id_radio_choice_2" name="radio_choice" type="radio" value="2" />
Two
</label>
</div>
<div class=" col-sm-10 col-lg-10">
<div class="radio">
<label>
<input id="id_radio_choice_0" name="radio_choice" type="radio" value="0" />
Zero
</label>
</div>
<div class="radio">
<label>
<input id="id_radio_choice_1" name="radio_choice" type="radio" value="1" />
One
</label>
</div>
<div class="radio">
<label>
<input id="id_radio_choice_2" name="radio_choice" type="radio" value="2" />
Two
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 " for="id_multiple_choice">Multiple choice</label>
<label class="control-label col-sm-2 col-lg-2 " for="id_multiple_choice">Multiple choice</label>
<div class=" col-sm-10 col-lg-10 ">
<select multiple="multiple" class=" form-control" id="id_multiple_choice" name="multiple_choice">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
<div class=" col-sm-10 col-lg-10 ">
<select multiple="multiple" class=" form-control" id="id_multiple_choice" name="multiple_choice">
<option value="0">Zero</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 " for="id_multiple_checkbox">Multiple checkbox</label>
<div class=" col-sm-10 col-lg-10 multiple-checkbox">
<ul id="id_multiple_checkbox">
<li><label for="id_multiple_checkbox_0"><input id="id_multiple_checkbox_0" name="multiple_checkbox" type="checkbox" value="0" /> Zero</label></li>
<li><label for="id_multiple_checkbox_1"><input id="id_multiple_checkbox_1" name="multiple_checkbox" type="checkbox" value="1" /> One</label></li>
<li><label for="id_multiple_checkbox_2"><input id="id_multiple_checkbox_2" name="multiple_checkbox" type="checkbox" value="2" /> Two</label></li>
</ul>
</div>
<label class="control-label col-sm-2 col-lg-2 " for="id_multiple_checkbox">Multiple checkbox</label>
<div class=" col-sm-10 col-lg-10 multiple-checkbox">
<ul id="id_multiple_checkbox">
<li><label for="id_multiple_checkbox_0"><input id="id_multiple_checkbox_0" name="multiple_checkbox" type="checkbox" value="0" /> Zero</label></li>
<li><label for="id_multiple_checkbox_1"><input id="id_multiple_checkbox_1" name="multiple_checkbox" type="checkbox" value="1" /> One</label></li>
<li><label for="id_multiple_checkbox_2"><input id="id_multiple_checkbox_2" name="multiple_checkbox" type="checkbox" value="2" /> Two</label></li>
</ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 " for="id_file_fied">File fied</label>
<label class="control-label col-sm-2 col-lg-2 " for="id_file_fied">File fied</label>
<div class=" col-sm-10 col-lg-10 ">
<input id="id_file_fied" name="file_fied" type="file" />
</div>
<div class=" col-sm-10 col-lg-10 ">
<input id="id_file_fied" name="file_fied" type="file" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 " for="id_password_field">Password field</label>
<label class="control-label col-sm-2 col-lg-2 " for="id_password_field">Password field</label>
<div class=" col-sm-10 col-lg-10 ">
<input class=" form-control" id="id_password_field" name="password_field" type="password" />
</div>
<div class=" col-sm-10 col-lg-10 ">
<input class=" form-control" id="id_password_field" name="password_field" type="password" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-lg-2 " for="id_textarea">Textarea</label>
<label class="control-label col-sm-2 col-lg-2 " for="id_textarea">Textarea</label>
<div class=" col-sm-10 col-lg-10 ">
<textarea class=" form-control" cols="40" id="id_textarea" name="textarea" rows="10">
</textarea>
</div>
<div class=" col-sm-10 col-lg-10 ">
<textarea class=" form-control" cols="40" id="id_textarea" name="textarea" rows="10">
</textarea>
</div>
</div>
<div class="form-group">
<div class=" col-sm-offset-2 col-sm-10 col-lg-offset-2 col-lg-10">
<div class="checkbox">
<label >
<input id="id_boolean_field" name="boolean_field" type="checkbox" /> <span>Boolean field</span>
</label>
</div>
<div class=" col-sm-offset-2 col-sm-10 col-lg-offset-2 col-lg-10">
<div class="checkbox">
<label >
<input id="id_boolean_field" name="boolean_field" type="checkbox" /> <span>Boolean field</span>
</label>
</div>
</div>
</div>

View File

@ -1,5 +1,6 @@
import os
import django
from django.test import TestCase
from django.template import Template, Context
from django.core.management import call_command
@ -15,6 +16,12 @@ CHOICES = (
(2, 'Two'),
)
try:
# required by Django 1.7 and later
django.setup()
except:
pass
class ExampleForm(forms.Form):
char_field = forms.CharField()
choice_field = forms.ChoiceField(choices=CHOICES)

View File

@ -44,7 +44,10 @@ def runtests(**test_args):
parent = dirname(abspath(__file__))
sys.path.insert(0, parent)
django.setup()
try:
django.setup()
except:
pass
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True)

47
tests/test_settings.py Normal file
View File

@ -0,0 +1,47 @@
import os
local_path = lambda path: os.path.join(os.path.dirname(__file__), path)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
SITE_ID = 1
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contrib.auth',
'django.contrib.admin',
'bootstrapform',
]
ROOT_URLCONF = 'tests.urls'
MEDIA_URL = '/media/'
MEDIA_ROOT = local_path('media')
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
STATIC_ROOT = local_path('static/')
STATIC_URL = '/static/'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
)
TEMPLATE_DIRS = (
local_path('templates'),
)
SECRET_KEY = 'django-bootstrap-form'