Fixed E221 pep8 warnings.
This commit is contained in:
parent
0d0f4f020a
commit
1597503a01
|
@ -134,8 +134,8 @@ def result_headers(cl):
|
|||
|
||||
# build new ordering param
|
||||
o_list_primary = [] # URL for making this field the primary sort
|
||||
o_list_remove = [] # URL for removing this field from sort
|
||||
o_list_toggle = [] # URL for toggling order type for this field
|
||||
o_list_remove = [] # URL for removing this field from sort
|
||||
o_list_toggle = [] # URL for toggling order type for this field
|
||||
make_qs_param = lambda t, n: ('-' if t == 'desc' else '') + str(n)
|
||||
|
||||
for j, ot in ordering_field_columns.items():
|
||||
|
|
|
@ -204,7 +204,13 @@ def model_detail(request, app_label, model_name):
|
|||
if isinstance(field, models.ForeignKey):
|
||||
data_type = field.rel.to.__name__
|
||||
app_label = field.rel.to._meta.app_label
|
||||
verbose = utils.parse_rst((_("the related `%(app_label)s.%(data_type)s` object") % {'app_label': app_label, 'data_type': data_type}), 'model', _('model:') + data_type)
|
||||
verbose = utils.parse_rst(
|
||||
(_("the related `%(app_label)s.%(data_type)s` object") % {
|
||||
'app_label': app_label, 'data_type': data_type,
|
||||
}),
|
||||
'model',
|
||||
_('model:') + data_type,
|
||||
)
|
||||
else:
|
||||
data_type = get_readable_field_data_type(field)
|
||||
verbose = field.verbose_name
|
||||
|
|
|
@ -275,7 +275,6 @@ class TestUtilsHashPass(unittest.TestCase):
|
|||
finally:
|
||||
hasher.iterations = old_iterations
|
||||
|
||||
|
||||
def test_load_library_no_algorithm(self):
|
||||
with self.assertRaises(ValueError) as e:
|
||||
BasePasswordHasher()._load_library()
|
||||
|
|
|
@ -678,7 +678,7 @@ class GeoQuerySet(QuerySet):
|
|||
procedure_fmt += ', %s(%%%%s, %s)' % (backend.transform, self.query.transformed_srid)
|
||||
else:
|
||||
# `transform()` was not used on this GeoQuerySet.
|
||||
procedure_fmt = '%(geo_col)s,%(geom)s'
|
||||
procedure_fmt = '%(geo_col)s,%(geom)s'
|
||||
|
||||
if not geography and geodetic:
|
||||
# Spherical distance calculation is needed (because the geographic
|
||||
|
|
|
@ -41,11 +41,11 @@ class GeoIP(object):
|
|||
#
|
||||
# GEOIP_MMAP_CACHE - load database into mmap shared memory ( not available
|
||||
# on Windows).
|
||||
GEOIP_STANDARD = 0
|
||||
GEOIP_STANDARD = 0
|
||||
GEOIP_MEMORY_CACHE = 1
|
||||
GEOIP_CHECK_CACHE = 2
|
||||
GEOIP_INDEX_CACHE = 4
|
||||
GEOIP_MMAP_CACHE = 8
|
||||
GEOIP_CHECK_CACHE = 2
|
||||
GEOIP_INDEX_CACHE = 4
|
||||
GEOIP_MMAP_CACHE = 8
|
||||
cache_options = dict((opt, None) for opt in (0, 1, 2, 4, 8))
|
||||
|
||||
# Paths to the city & country binary databases.
|
||||
|
|
|
@ -100,7 +100,7 @@ class GEOSContextHandle_t(Structure):
|
|||
GEOM_PTR = POINTER(GEOSGeom_t)
|
||||
PREPGEOM_PTR = POINTER(GEOSPrepGeom_t)
|
||||
CS_PTR = POINTER(GEOSCoordSeq_t)
|
||||
CONTEXT_PTR = POINTER(GEOSContextHandle_t)
|
||||
CONTEXT_PTR = POINTER(GEOSContextHandle_t)
|
||||
|
||||
# Used specifically by the GEOSGeom_createPolygon and GEOSGeom_createCollection
|
||||
# GEOS routines
|
||||
|
|
|
@ -88,17 +88,17 @@ class ListMixin(object):
|
|||
raise TypeError("%s is not a legal index" % index)
|
||||
|
||||
# calculate new length and dimensions
|
||||
origLen = len(self)
|
||||
origLen = len(self)
|
||||
if isinstance(index, six.integer_types):
|
||||
index = self._checkindex(index)
|
||||
indexRange = [index]
|
||||
indexRange = [index]
|
||||
else:
|
||||
indexRange = range(*index.indices(origLen))
|
||||
indexRange = range(*index.indices(origLen))
|
||||
|
||||
newLen = origLen - len(indexRange)
|
||||
newItems = (self._get_single_internal(i)
|
||||
for i in xrange(origLen)
|
||||
if i not in indexRange)
|
||||
newLen = origLen - len(indexRange)
|
||||
newItems = (self._get_single_internal(i)
|
||||
for i in xrange(origLen)
|
||||
if i not in indexRange)
|
||||
|
||||
self._rebuild(newLen, newItems)
|
||||
|
||||
|
@ -268,8 +268,8 @@ class ListMixin(object):
|
|||
|
||||
self._check_allowed(values)
|
||||
|
||||
origLen = len(self)
|
||||
valueList = list(values)
|
||||
origLen = len(self)
|
||||
valueList = list(values)
|
||||
start, stop, step = index.indices(origLen)
|
||||
|
||||
# CAREFUL: index.step and step are not the same!
|
||||
|
@ -281,7 +281,7 @@ class ListMixin(object):
|
|||
|
||||
def _assign_extended_slice_rebuild(self, start, stop, step, valueList):
|
||||
'Assign an extended slice by rebuilding entire list'
|
||||
indexList = range(start, stop, step)
|
||||
indexList = range(start, stop, step)
|
||||
# extended slice, only allow assigning slice of same size
|
||||
if len(valueList) != len(indexList):
|
||||
raise ValueError('attempt to assign sequence of size %d '
|
||||
|
@ -289,7 +289,7 @@ class ListMixin(object):
|
|||
% (len(valueList), len(indexList)))
|
||||
|
||||
# we're not changing the length of the sequence
|
||||
newLen = len(self)
|
||||
newLen = len(self)
|
||||
newVals = dict(zip(indexList, valueList))
|
||||
def newItems():
|
||||
for i in xrange(newLen):
|
||||
|
@ -302,7 +302,7 @@ class ListMixin(object):
|
|||
|
||||
def _assign_extended_slice(self, start, stop, step, valueList):
|
||||
'Assign an extended slice by re-assigning individual items'
|
||||
indexList = range(start, stop, step)
|
||||
indexList = range(start, stop, step)
|
||||
# extended slice, only allow assigning slice of same size
|
||||
if len(valueList) != len(indexList):
|
||||
raise ValueError('attempt to assign sequence of size %d '
|
||||
|
@ -316,7 +316,7 @@ class ListMixin(object):
|
|||
'Assign a simple slice; Can assign slice of any length'
|
||||
origLen = len(self)
|
||||
stop = max(start, stop)
|
||||
newLen = origLen - stop + start + len(valueList)
|
||||
newLen = origLen - stop + start + len(valueList)
|
||||
def newItems():
|
||||
for i in xrange(origLen + 1):
|
||||
if i == start:
|
||||
|
|
|
@ -37,11 +37,11 @@ class Polygon(GEOSGeometry):
|
|||
# If initialized as Polygon(shell, (LinearRing, LinearRing)) [for backward-compatibility]
|
||||
if n_holes == 1 and isinstance(init_holes[0], (tuple, list)):
|
||||
if len(init_holes[0]) == 0:
|
||||
init_holes = ()
|
||||
n_holes = 0
|
||||
init_holes = ()
|
||||
n_holes = 0
|
||||
elif isinstance(init_holes[0][0], LinearRing):
|
||||
init_holes = init_holes[0]
|
||||
n_holes = len(init_holes)
|
||||
init_holes = init_holes[0]
|
||||
n_holes = len(init_holes)
|
||||
|
||||
polygon = self._create_polygon(n_holes + 1, (ext_ring,) + init_holes)
|
||||
super(Polygon, self).__init__(polygon, **kwargs)
|
||||
|
|
|
@ -23,9 +23,9 @@ class WKBReader_st(Structure):
|
|||
class WKBWriter_st(Structure):
|
||||
pass
|
||||
|
||||
WKT_READ_PTR = POINTER(WKTReader_st)
|
||||
WKT_READ_PTR = POINTER(WKTReader_st)
|
||||
WKT_WRITE_PTR = POINTER(WKTWriter_st)
|
||||
WKB_READ_PTR = POINTER(WKBReader_st)
|
||||
WKB_READ_PTR = POINTER(WKBReader_st)
|
||||
WKB_WRITE_PTR = POINTER(WKBReader_st)
|
||||
|
||||
### WKTReader routines ###
|
||||
|
@ -114,8 +114,8 @@ def wkb_writer_set(func, argtype=c_int):
|
|||
|
||||
wkb_writer_get_byteorder = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getByteOrder'))
|
||||
wkb_writer_set_byteorder = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setByteOrder'))
|
||||
wkb_writer_get_outdim = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getOutputDimension'))
|
||||
wkb_writer_set_outdim = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setOutputDimension'))
|
||||
wkb_writer_get_outdim = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getOutputDimension'))
|
||||
wkb_writer_set_outdim = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setOutputDimension'))
|
||||
wkb_writer_get_include_srid = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getIncludeSRID'), restype=c_char)
|
||||
wkb_writer_set_include_srid = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setIncludeSRID'), argtype=c_char)
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ class GoogleMap(object):
|
|||
|
||||
# String constants
|
||||
onunload = mark_safe('onunload="GUnload()"') # Cleans up after Google Maps
|
||||
vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML
|
||||
xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML).
|
||||
vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML
|
||||
xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML).
|
||||
|
||||
def __init__(self, key=None, api_url=None, version=None,
|
||||
center=None, zoom=None, dom_id='map',
|
||||
|
|
|
@ -34,7 +34,7 @@ class GoogleZoom(object):
|
|||
# zoom levels.
|
||||
self._degpp = [] # Degrees per pixel
|
||||
self._radpp = [] # Radians per pixel
|
||||
self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level
|
||||
self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level
|
||||
|
||||
# Incrementing through the zoom levels and populating the parameter arrays.
|
||||
z = tilesize # The number of pixels per zoom level.
|
||||
|
@ -158,5 +158,5 @@ class GoogleZoom(object):
|
|||
ur = Point(extent[2:])
|
||||
# Calculating the width and height.
|
||||
height = ll.distance(ul)
|
||||
width = ul.distance(ur)
|
||||
width = ul.distance(ur)
|
||||
return width, height
|
||||
|
|
|
@ -51,8 +51,8 @@ def pretty_name(obj):
|
|||
@total_ordering
|
||||
class MeasureBase(object):
|
||||
STANDARD_UNIT = None
|
||||
ALIAS = {}
|
||||
UNITS = {}
|
||||
ALIAS = {}
|
||||
UNITS = {}
|
||||
LALIAS = {}
|
||||
|
||||
def __init__(self, default_unit=None, **kwargs):
|
||||
|
|
|
@ -118,7 +118,7 @@ class GeoModelTest(TestCase):
|
|||
# San Antonio in 'Texas 4205, Southern Zone (1983, meters)' (SRID 41157)
|
||||
# Used the following Oracle SQL to get this value:
|
||||
# SELECT SDO_UTIL.TO_WKTGEOMETRY(SDO_CS.TRANSFORM(SDO_GEOMETRY('POINT (-98.493183 29.424170)', 4326), 41157)) FROM DUAL;
|
||||
nad_wkt = 'POINT (300662.034646583 5416427.45974934)'
|
||||
nad_wkt = 'POINT (300662.034646583 5416427.45974934)'
|
||||
nad_srid = 41157
|
||||
else:
|
||||
# San Antonio in 'NAD83(HARN) / Texas Centric Lambert Conformal' (SRID 3084)
|
||||
|
|
|
@ -31,8 +31,8 @@ inter_shp = os.path.join(shp_path, 'interstates', 'interstates.shp')
|
|||
invalid_shp = os.path.join(shp_path, 'invalid', 'emptypoints.shp')
|
||||
|
||||
# Dictionaries to hold what's expected in the county shapefile.
|
||||
NAMES = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo']
|
||||
NUMS = [1, 2, 1, 19, 1] # Number of polygons for each.
|
||||
NAMES = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo']
|
||||
NUMS = [1, 2, 1, 19, 1] # Number of polygons for each.
|
||||
STATES = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado']
|
||||
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ def no_spatialite(func):
|
|||
|
||||
# Shortcut booleans to omit only portions of tests.
|
||||
_default_db = settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1]
|
||||
oracle = _default_db == 'oracle'
|
||||
oracle = _default_db == 'oracle'
|
||||
postgis = _default_db == 'postgis'
|
||||
mysql = _default_db == 'mysql'
|
||||
mysql = _default_db == 'mysql'
|
||||
spatialite = _default_db == 'spatialite'
|
||||
|
||||
HAS_SPATIALREFSYS = True
|
||||
|
|
|
@ -57,9 +57,9 @@ class BaseTests(object):
|
|||
|
||||
def setUp(self):
|
||||
self.settings_override = override_settings_tags(
|
||||
TEMPLATE_DIRS = (),
|
||||
TEMPLATE_DIRS = (),
|
||||
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS,
|
||||
MESSAGE_TAGS = '',
|
||||
MESSAGE_TAGS = '',
|
||||
MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__,
|
||||
self.storage_class.__name__),
|
||||
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer',
|
||||
|
|
|
@ -229,7 +229,7 @@ class TemplateCommand(BaseCommand):
|
|||
tmp = url.rstrip('/')
|
||||
filename = tmp.split('/')[-1]
|
||||
if url.endswith('/'):
|
||||
display_url = tmp + '/'
|
||||
display_url = tmp + '/'
|
||||
else:
|
||||
display_url = url
|
||||
return filename, display_url
|
||||
|
|
|
@ -194,10 +194,10 @@ def linenumbers(value, autoescape=None):
|
|||
width = six.text_type(len(six.text_type(len(lines))))
|
||||
if not autoescape or isinstance(value, SafeData):
|
||||
for i, line in enumerate(lines):
|
||||
lines[i] = ("%0" + width + "d. %s") % (i + 1, line)
|
||||
lines[i] = ("%0" + width + "d. %s") % (i + 1, line)
|
||||
else:
|
||||
for i, line in enumerate(lines):
|
||||
lines[i] = ("%0" + width + "d. %s") % (i + 1, escape(line))
|
||||
lines[i] = ("%0" + width + "d. %s") % (i + 1, escape(line))
|
||||
return mark_safe('\n'.join(lines))
|
||||
|
||||
@register.filter(is_safe=True)
|
||||
|
|
|
@ -490,19 +490,19 @@ class ImmutableList(tuple):
|
|||
raise AttributeError(self.warning)
|
||||
|
||||
# All list mutation functions complain.
|
||||
__delitem__ = complain
|
||||
__delitem__ = complain
|
||||
__delslice__ = complain
|
||||
__iadd__ = complain
|
||||
__imul__ = complain
|
||||
__setitem__ = complain
|
||||
__iadd__ = complain
|
||||
__imul__ = complain
|
||||
__setitem__ = complain
|
||||
__setslice__ = complain
|
||||
append = complain
|
||||
extend = complain
|
||||
insert = complain
|
||||
pop = complain
|
||||
remove = complain
|
||||
sort = complain
|
||||
reverse = complain
|
||||
append = complain
|
||||
extend = complain
|
||||
insert = complain
|
||||
pop = complain
|
||||
remove= complain
|
||||
sort = complain
|
||||
reverse = complain
|
||||
|
||||
class DictWrapper(dict):
|
||||
"""
|
||||
|
|
|
@ -27,11 +27,11 @@ class RWLock(object):
|
|||
writer_leaves()
|
||||
"""
|
||||
def __init__(self):
|
||||
self.mutex = threading.RLock()
|
||||
self.can_read = threading.Semaphore(0)
|
||||
self.mutex = threading.RLock()
|
||||
self.can_read = threading.Semaphore(0)
|
||||
self.can_write = threading.Semaphore(0)
|
||||
self.active_readers = 0
|
||||
self.active_writers = 0
|
||||
self.active_readers = 0
|
||||
self.active_writers = 0
|
||||
self.waiting_readers = 0
|
||||
self.waiting_writers = 0
|
||||
|
||||
|
@ -48,7 +48,7 @@ class RWLock(object):
|
|||
with self.mutex:
|
||||
self.active_readers -= 1
|
||||
if self.active_readers == 0 and self.waiting_writers != 0:
|
||||
self.active_writers += 1
|
||||
self.active_writers += 1
|
||||
self.waiting_writers -= 1
|
||||
self.can_write.release()
|
||||
|
||||
|
@ -73,7 +73,7 @@ class RWLock(object):
|
|||
with self.mutex:
|
||||
self.active_writers -= 1
|
||||
if self.waiting_writers != 0:
|
||||
self.active_writers += 1
|
||||
self.active_writers += 1
|
||||
self.waiting_writers -= 1
|
||||
self.can_write.release()
|
||||
elif self.waiting_readers != 0:
|
||||
|
|
|
@ -22,35 +22,35 @@ simple_option_desc_re = re.compile(
|
|||
def setup(app):
|
||||
app.add_crossref_type(
|
||||
directivename = "setting",
|
||||
rolename = "setting",
|
||||
rolename = "setting",
|
||||
indextemplate = "pair: %s; setting",
|
||||
)
|
||||
app.add_crossref_type(
|
||||
directivename = "templatetag",
|
||||
rolename = "ttag",
|
||||
rolename = "ttag",
|
||||
indextemplate = "pair: %s; template tag"
|
||||
)
|
||||
app.add_crossref_type(
|
||||
directivename = "templatefilter",
|
||||
rolename = "tfilter",
|
||||
rolename = "tfilter",
|
||||
indextemplate = "pair: %s; template filter"
|
||||
)
|
||||
app.add_crossref_type(
|
||||
directivename = "fieldlookup",
|
||||
rolename = "lookup",
|
||||
rolename = "lookup",
|
||||
indextemplate = "pair: %s; field lookup type",
|
||||
)
|
||||
app.add_description_unit(
|
||||
directivename = "django-admin",
|
||||
rolename = "djadmin",
|
||||
rolename = "djadmin",
|
||||
indextemplate = "pair: %s; django-admin command",
|
||||
parse_node = parse_django_admin_node,
|
||||
parse_node = parse_django_admin_node,
|
||||
)
|
||||
app.add_description_unit(
|
||||
directivename = "django-admin-option",
|
||||
rolename = "djadminopt",
|
||||
rolename = "djadminopt",
|
||||
indextemplate = "pair: %s; django-admin command-line option",
|
||||
parse_node = parse_django_adminopt_node,
|
||||
parse_node = parse_django_adminopt_node,
|
||||
)
|
||||
app.add_config_value('django_next_version', '0.0', True)
|
||||
app.add_directive('versionadded', VersionDirective)
|
||||
|
|
|
@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
|
|||
|
||||
[flake8]
|
||||
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py
|
||||
ignore=E124,E125,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E231,E261,E301,F401,F403,W601
|
||||
ignore=E124,E125,E127,E128,E225,E226,E241,E251,E302,E501,E203,E231,E261,E301,F401,F403,W601
|
||||
|
||||
[metadata]
|
||||
license-file = LICENSE
|
||||
|
|
|
@ -22,7 +22,6 @@ from .models import Article, Count, Event, Location, EventGuide
|
|||
class NestedObjectsTests(TestCase):
|
||||
"""
|
||||
Tests for ``NestedObject`` utility collection.
|
||||
|
||||
"""
|
||||
def setUp(self):
|
||||
self.n = NestedObjects(using=DEFAULT_DB_ALIAS)
|
||||
|
@ -295,7 +294,7 @@ class UtilTests(SimpleTestCase):
|
|||
# safestring should not be escaped
|
||||
class MyForm(forms.Form):
|
||||
text = forms.CharField(label=mark_safe('<i>text</i>'))
|
||||
cb = forms.BooleanField(label=mark_safe('<i>cb</i>'))
|
||||
cb = forms.BooleanField(label=mark_safe('<i>cb</i>'))
|
||||
|
||||
form = MyForm()
|
||||
self.assertHTMLEqual(helpers.AdminField(form, 'text', is_first=False).label_tag(),
|
||||
|
@ -306,7 +305,7 @@ class UtilTests(SimpleTestCase):
|
|||
# normal strings needs to be escaped
|
||||
class MyForm(forms.Form):
|
||||
text = forms.CharField(label='&text')
|
||||
cb = forms.BooleanField(label='&cb')
|
||||
cb = forms.BooleanField(label='&cb')
|
||||
|
||||
form = MyForm()
|
||||
self.assertHTMLEqual(helpers.AdminField(form, 'text', is_first=False).label_tag(),
|
||||
|
|
|
@ -1190,16 +1190,16 @@ class LocaleMiddlewareTests(TransRealMixin, TestCase):
|
|||
|
||||
# Clear the session data before request
|
||||
session.save()
|
||||
response = self.client.get('/en/simple/')
|
||||
self.client.get('/en/simple/')
|
||||
self.assertEqual(self.client.session['_language'], 'en')
|
||||
|
||||
# Clear the session data before request
|
||||
session.save()
|
||||
response = self.client.get('/fr/simple/')
|
||||
self.client.get('/fr/simple/')
|
||||
self.assertEqual(self.client.session['_language'], 'fr')
|
||||
|
||||
# Check that language is not changed in session
|
||||
response = self.client.get('/en/simple/')
|
||||
self.client.get('/en/simple/')
|
||||
self.assertEqual(self.client.session['_language'], 'fr')
|
||||
|
||||
@override_settings(
|
||||
|
@ -1221,7 +1221,7 @@ class LocaleMiddlewareTests(TransRealMixin, TestCase):
|
|||
self.client.cookies[settings.SESSION_COOKIE_NAME] = session.session_key
|
||||
|
||||
# request other language; should default to old language key value
|
||||
response = self.client.get('/fr/simple/')
|
||||
self.client.get('/fr/simple/')
|
||||
self.assertEqual(self.client.session['_language'], 'en')
|
||||
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class M2MThroughTestCase(TestCase):
|
|||
|
||||
def test_join_trimming(self):
|
||||
"Check that we don't involve too many copies of the intermediate table when doing a join. Refs #8046, #8254"
|
||||
bob = Person.objects.create(name="Bob")
|
||||
bob = Person.objects.create(name="Bob")
|
||||
jim = Person.objects.create(name="Jim")
|
||||
|
||||
rock = Group.objects.create(name="Rock")
|
||||
|
|
|
@ -466,7 +466,7 @@ class ModelFormsetTest(TestCase):
|
|||
formset = AuthorBooksFormSet(instance=author)
|
||||
self.assertEqual(len(formset.forms), 3)
|
||||
self.assertHTMLEqual(formset.forms[0].as_p(),
|
||||
'<p><label for="id_book_set-0-title">Title:</label> <input id="id_book_set-0-title" type="text" name="book_set-0-title" maxlength="100" /><input type="hidden" name="book_set-0-author" value="%d" id="id_book_set-0-author" /><input type="hidden" name="book_set-0-id" id="id_book_set-0-id" /></p>' % author.id)
|
||||
'<p><label for="id_book_set-0-title">Title:</label> <input id="id_book_set-0-title" type="text" name="book_set-0-title" maxlength="100" /><input type="hidden" name="book_set-0-author" value="%d" id="id_book_set-0-author" /><input type="hidden" name="book_set-0-id" id="id_book_set-0-id" /></p>' % author.id)
|
||||
self.assertHTMLEqual(formset.forms[1].as_p(),
|
||||
'<p><label for="id_book_set-1-title">Title:</label> <input id="id_book_set-1-title" type="text" name="book_set-1-title" maxlength="100" /><input type="hidden" name="book_set-1-author" value="%d" id="id_book_set-1-author" /><input type="hidden" name="book_set-1-id" id="id_book_set-1-id" /></p>' % author.id)
|
||||
self.assertHTMLEqual(formset.forms[2].as_p(),
|
||||
|
|
|
@ -1864,7 +1864,7 @@ class SyncOnlyDefaultDatabaseRouter(object):
|
|||
|
||||
class MigrateTestCase(TestCase):
|
||||
|
||||
available_apps = [
|
||||
available_apps = [
|
||||
'multiple_database',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes'
|
||||
|
|
|
@ -147,8 +147,8 @@ class Comment(models.Model):
|
|||
comment = models.TextField()
|
||||
|
||||
# Content-object field
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
object_pk = models.TextField()
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
object_pk = models.TextField()
|
||||
content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk")
|
||||
|
||||
|
||||
|
|
|
@ -1437,7 +1437,7 @@ class Queries4Tests(BaseQuerysetTest):
|
|||
self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False)
|
||||
|
||||
def test_ticket15316_one2one_filter_false(self):
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c0 = SimpleCategory.objects.create(name="cat0")
|
||||
c1 = SimpleCategory.objects.create(name="category1")
|
||||
|
||||
|
@ -1453,7 +1453,7 @@ class Queries4Tests(BaseQuerysetTest):
|
|||
self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False)
|
||||
|
||||
def test_ticket15316_one2one_exclude_false(self):
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c0 = SimpleCategory.objects.create(name="cat0")
|
||||
c1 = SimpleCategory.objects.create(name="category1")
|
||||
|
||||
|
@ -1469,7 +1469,7 @@ class Queries4Tests(BaseQuerysetTest):
|
|||
self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)
|
||||
|
||||
def test_ticket15316_one2one_filter_true(self):
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c0 = SimpleCategory.objects.create(name="cat0")
|
||||
c1 = SimpleCategory.objects.create(name="category1")
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ class Queries4Tests(BaseQuerysetTest):
|
|||
self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk)
|
||||
|
||||
def test_ticket15316_one2one_exclude_true(self):
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c = SimpleCategory.objects.create(name="cat")
|
||||
c0 = SimpleCategory.objects.create(name="cat0")
|
||||
c1 = SimpleCategory.objects.create(name="category1")
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class UniqueForDateModel(models.Model):
|
|||
name = models.CharField(max_length=100)
|
||||
|
||||
class CustomMessagesModel(models.Model):
|
||||
other = models.IntegerField(blank=True, null=True)
|
||||
other = models.IntegerField(blank=True, null=True)
|
||||
number = models.IntegerField(db_column='number_val',
|
||||
error_messages={'null': 'NULL', 'not42': 'AAARGH', 'not_equal': '%s != me'},
|
||||
validators=[validate_answer_to_universe]
|
||||
|
|
Loading…
Reference in New Issue