This commit is contained in:
Veres Lajos 2014-11-03 22:48:03 +00:00 committed by Tim Graham
parent 7b42036752
commit a71a2ea756
21 changed files with 28 additions and 28 deletions

View File

@ -15,7 +15,7 @@ function findForm(node) {
window.SelectFilter = { window.SelectFilter = {
init: function(field_id, field_name, is_stacked, admin_static_prefix) { init: function(field_id, field_name, is_stacked, admin_static_prefix) {
if (field_id.match(/__prefix__/)){ if (field_id.match(/__prefix__/)){
// Don't intialize on empty forms. // Don't initialize on empty forms.
return; return;
} }
var from_box = document.getElementById(field_id); var from_box = document.getElementById(field_id);

View File

@ -385,7 +385,7 @@ class PasswordResetFormTest(TestCase):
self.assertFalse(form.is_valid()) self.assertFalse(form.is_valid())
self.assertEqual(form['email'].errors, [_('Enter a valid email address.')]) self.assertEqual(form['email'].errors, [_('Enter a valid email address.')])
def test_nonexistant_email(self): def test_nonexistent_email(self):
""" """
Test nonexistent email address. This should not fail because it would Test nonexistent email address. This should not fail because it would
expose information about registered users. expose information about registered users.

View File

@ -12,7 +12,7 @@ class GeoQuery(sql.Query):
""" """
A single spatial SQL query. A single spatial SQL query.
""" """
# Overridding the valid query terms. # Overriding the valid query terms.
query_terms = QUERY_TERMS | set(GeometryField.class_lookups.keys()) query_terms = QUERY_TERMS | set(GeometryField.class_lookups.keys())
aggregates_module = gis_aggregates aggregates_module = gis_aggregates

View File

@ -1,5 +1,5 @@
""" """
The Spatial Reference class, represensents OGR Spatial Reference objects. The Spatial Reference class, represents OGR Spatial Reference objects.
Example: Example:
>>> from django.contrib.gis.gdal import SpatialReference >>> from django.contrib.gis.gdal import SpatialReference

View File

@ -187,7 +187,7 @@ class Deserializer(base.Deserializer):
m2m_data = {} m2m_data = {}
model_fields = Model._meta.get_all_field_names() model_fields = Model._meta.get_all_field_names()
# Deseralize each field. # Deserialize each field.
for field_node in node.getElementsByTagName("field"): for field_node in node.getElementsByTagName("field"):
# If the field is missing the name attribute, bail (are you # If the field is missing the name attribute, bail (are you
# sensing a pattern here?) # sensing a pattern here?)

View File

@ -1776,7 +1776,7 @@ class ForeignKey(ForeignObject):
params={ params={
'model': self.rel.to._meta.verbose_name, 'pk': value, 'model': self.rel.to._meta.verbose_name, 'pk': value,
'field': self.rel.field_name, 'value': value, 'field': self.rel.field_name, 'value': value,
}, # 'pk' is included for backwards compatibilty }, # 'pk' is included for backwards compatibility
) )
def get_attname(self): def get_attname(self):

View File

@ -407,7 +407,7 @@ class SystemChecksTestCase(TestCase):
errors = SongAdmin.check(model=Song) errors = SongAdmin.check(model=Song)
self.assertEqual(errors, []) self.assertEqual(errors, [])
def test_nonexistant_field(self): def test_nonexistent_field(self):
class SongAdmin(admin.ModelAdmin): class SongAdmin(admin.ModelAdmin):
readonly_fields = ("title", "nonexistent") readonly_fields = ("title", "nonexistent")
@ -423,7 +423,7 @@ class SystemChecksTestCase(TestCase):
] ]
self.assertEqual(errors, expected) self.assertEqual(errors, expected)
def test_nonexistant_field_on_inline(self): def test_nonexistent_field_on_inline(self):
class CityInline(admin.TabularInline): class CityInline(admin.TabularInline):
model = City model = City
readonly_fields = ['i_dont_exist'] # Missing attribute readonly_fields = ['i_dont_exist'] # Missing attribute

View File

@ -212,7 +212,7 @@ class ValidationTestCase(TestCase):
warnings.filterwarnings('ignore', module='django.contrib.admin.options') warnings.filterwarnings('ignore', module='django.contrib.admin.options')
SongAdmin.validate(Song) SongAdmin.validate(Song)
def test_nonexistant_field(self): def test_nonexistent_field(self):
class SongAdmin(admin.ModelAdmin): class SongAdmin(admin.ModelAdmin):
readonly_fields = ("title", "nonexistent") readonly_fields = ("title", "nonexistent")
@ -222,7 +222,7 @@ class ValidationTestCase(TestCase):
SongAdmin.validate, SongAdmin.validate,
Song) Song)
def test_nonexistant_field_on_inline(self): def test_nonexistent_field_on_inline(self):
class CityInline(admin.TabularInline): class CityInline(admin.TabularInline):
model = City model = City
readonly_fields = ['i_dont_exist'] # Missing attribute readonly_fields = ['i_dont_exist'] # Missing attribute

View File

@ -479,7 +479,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
response = self.client.get('/test_admin/%s/admin_views/thing/' % self.urlbit, {'notarealfield': '5'}) response = self.client.get('/test_admin/%s/admin_views/thing/' % self.urlbit, {'notarealfield': '5'})
self.assertRedirects(response, '/test_admin/%s/admin_views/thing/?e=1' % self.urlbit) self.assertRedirects(response, '/test_admin/%s/admin_views/thing/?e=1' % self.urlbit)
# Spanning relationships through an inexistant related object (Refs #16716) # Spanning relationships through a nonexistent related object (Refs #16716)
response = self.client.get('/test_admin/%s/admin_views/thing/' % self.urlbit, {'notarealfield__whatever': '5'}) response = self.client.get('/test_admin/%s/admin_views/thing/' % self.urlbit, {'notarealfield__whatever': '5'})
self.assertRedirects(response, '/test_admin/%s/admin_views/thing/?e=1' % self.urlbit) self.assertRedirects(response, '/test_admin/%s/admin_views/thing/?e=1' % self.urlbit)
@ -605,7 +605,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
self.assertEqual(len(calls), 1) self.assertEqual(len(calls), 1)
# Specifying a field that is not refered by any other model registered # Specifying a field that is not referred by any other model registered
# to this admin site should raise an exception. # to this admin site should raise an exception.
with patch_logger('django.security.DisallowedModelAdminToField', 'error') as calls: with patch_logger('django.security.DisallowedModelAdminToField', 'error') as calls:
response = self.client.get("/test_admin/admin/admin_views/section/", {TO_FIELD_VAR: 'name'}) response = self.client.get("/test_admin/admin/admin_views/section/", {TO_FIELD_VAR: 'name'})
@ -624,12 +624,12 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
response = self.client.get("/test_admin/admin/admin_views/ingredient/", {TO_FIELD_VAR: 'id'}) response = self.client.get("/test_admin/admin/admin_views/ingredient/", {TO_FIELD_VAR: 'id'})
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
# #23329 - Specifying a field that is not refered by any other model directly registered # #23329 - Specifying a field that is not referred by any other model directly registered
# to this admin site but registered through inheritance should be allowed. # to this admin site but registered through inheritance should be allowed.
response = self.client.get("/test_admin/admin/admin_views/referencedbyparent/", {TO_FIELD_VAR: 'id'}) response = self.client.get("/test_admin/admin/admin_views/referencedbyparent/", {TO_FIELD_VAR: 'id'})
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
# #23431 - Specifying a field that is only refered to by a inline of a registered # #23431 - Specifying a field that is only referred to by a inline of a registered
# model should be allowed. # model should be allowed.
response = self.client.get("/test_admin/admin/admin_views/referencedbyinline/", {TO_FIELD_VAR: 'id'}) response = self.client.get("/test_admin/admin/admin_views/referencedbyinline/", {TO_FIELD_VAR: 'id'})
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)

View File

@ -963,7 +963,7 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCas
str(self.jenny.id), str(self.john.id)]) str(self.jenny.id), str(self.john.id)])
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Check that chosing a filtered option sends it properly to the # Check that choosing a filtered option sends it properly to the
# 'to' box. # 'to' box.
input.send_keys('a') input.send_keys('a')
self.assertSelectOptions(from_box, [str(self.arthur.id), str(self.jason.id)]) self.assertSelectOptions(from_box, [str(self.arthur.id), str(self.jason.id)])

View File

@ -981,7 +981,7 @@ class DBConstraintTestCase(TransactionTestCase):
available_apps = ['backends'] available_apps = ['backends']
def test_can_reference_existant(self): def test_can_reference_existent(self):
obj = models.Object.objects.create() obj = models.Object.objects.create()
ref = models.ObjectReference.objects.create(obj=obj) ref = models.ObjectReference.objects.create(obj=obj)
self.assertEqual(ref.obj, obj) self.assertEqual(ref.obj, obj)
@ -989,7 +989,7 @@ class DBConstraintTestCase(TransactionTestCase):
ref = models.ObjectReference.objects.get(obj=obj) ref = models.ObjectReference.objects.get(obj=obj)
self.assertEqual(ref.obj, obj) self.assertEqual(ref.obj, obj)
def test_can_reference_non_existant(self): def test_can_reference_non_existent(self):
self.assertFalse(models.Object.objects.filter(id=12345).exists()) self.assertFalse(models.Object.objects.filter(id=12345).exists())
ref = models.ObjectReference.objects.create(obj_id=12345) ref = models.ObjectReference.objects.create(obj_id=12345)
ref_new = models.ObjectReference.objects.get(obj_id=12345) ref_new = models.ObjectReference.objects.get(obj_id=12345)

View File

@ -54,7 +54,7 @@ class SQLCommandsTestCase(TestCase):
if 'CHECK' in statement: if 'CHECK' in statement:
success = True success = True
if not success: if not success:
self.fail("'CHECK' not found in ouput %s" % output) self.fail("'CHECK' not found in output %s" % output)
def test_sql_delete(self): def test_sql_delete(self):
app_config = apps.get_app_config('commands_sql') app_config = apps.get_app_config('commands_sql')

View File

@ -92,7 +92,7 @@ class CustomColumnsTests(TestCase):
def test_author_get(self): def test_author_get(self):
self.assertEqual(self.a1, Author.objects.get(first_name__exact='John')) self.assertEqual(self.a1, Author.objects.get(first_name__exact='John'))
def test_filter_on_nonexistant_field(self): def test_filter_on_nonexistent_field(self):
self.assertRaisesMessage( self.assertRaisesMessage(
FieldError, FieldError,
"Cannot resolve keyword 'firstname' into field. Choices are: Author_ID, article, first_name, last_name, primary_set", "Cannot resolve keyword 'firstname' into field. Choices are: Author_ID, article, first_name, last_name, primary_set",

View File

@ -271,7 +271,7 @@ class ExpressionsTests(TestCase):
# Another similar case for F() than above. Now we have the same join # Another similar case for F() than above. Now we have the same join
# in two filter kwargs, one in the lhs lookup, one in F. Here pre # in two filter kwargs, one in the lhs lookup, one in F. Here pre
# #18375 the amount of joins generated was random if dict # #18375 the amount of joins generated was random if dict
# randomization was enabled, that is the generated query dependend # randomization was enabled, that is the generated query dependent
# on which clause was seen first. # on which clause was seen first.
qs = Employee.objects.filter( qs = Employee.objects.filter(
company_ceo_set__num_employees=F('pk'), company_ceo_set__num_employees=F('pk'),

View File

@ -1116,7 +1116,7 @@ class ModelFormBasicTests(TestCase):
self.assertEqual(f.cleaned_data['slug'], 'entertainment') self.assertEqual(f.cleaned_data['slug'], 'entertainment')
self.assertEqual(f.cleaned_data['url'], 'entertainment') self.assertEqual(f.cleaned_data['url'], 'entertainment')
c1 = f.save() c1 = f.save()
# Testing wether the same object is returned from the # Testing whether the same object is returned from the
# ORM... not the fastest way... # ORM... not the fastest way...
self.assertEqual(Category.objects.count(), 1) self.assertEqual(Category.objects.count(), 1)

View File

@ -281,7 +281,7 @@ class ModelInheritanceTests(TestCase):
.defer("italianrestaurant__serves_gnocchi") .defer("italianrestaurant__serves_gnocchi")
.order_by("rating")) .order_by("rating"))
# Test that the field was actually defered # Test that the field was actually deferred
with self.assertNumQueries(2): with self.assertNumQueries(2):
objs = list(qs.all()) objs = list(qs.all())
self.assertTrue(objs[1].italianrestaurant.serves_gnocchi) self.assertTrue(objs[1].italianrestaurant.serves_gnocchi)

View File

@ -515,7 +515,7 @@ class SchemaTests(TransactionTestCase):
else: else:
self.fail("No FK constraint for author_id found") self.fail("No FK constraint for author_id found")
def test_alter_implicit_id_to_explict(self): def test_alter_implicit_id_to_explicit(self):
""" """
Should be able to convert an implicit "id" field to an explicit "id" Should be able to convert an implicit "id" field to an explicit "id"
primary key field. primary key field.

View File

@ -419,11 +419,11 @@ class SerializerTests(TestCase):
serializers.get_serializer("nonsense") serializers.get_serializer("nonsense")
self.assertEqual(cm.exception.args, ("nonsense",)) self.assertEqual(cm.exception.args, ("nonsense",))
def test_unregister_unkown_serializer(self): def test_unregister_unknown_serializer(self):
with self.assertRaises(SerializerDoesNotExist): with self.assertRaises(SerializerDoesNotExist):
serializers.unregister_serializer("nonsense") serializers.unregister_serializer("nonsense")
def test_get_unkown_deserializer(self): def test_get_unknown_deserializer(self):
with self.assertRaises(SerializerDoesNotExist): with self.assertRaises(SerializerDoesNotExist):
serializers.get_deserializer("nonsense") serializers.get_deserializer("nonsense")

View File

@ -37,7 +37,7 @@ class SignedCookieTest(TestCase):
self.assertRaises(signing.BadSignature, self.assertRaises(signing.BadSignature,
request.get_signed_cookie, 'c') request.get_signed_cookie, 'c')
def test_default_argument_supresses_exceptions(self): def test_default_argument_suppresses_exceptions(self):
response = HttpResponse() response = HttpResponse()
response.set_signed_cookie('c', 'hello') response.set_signed_cookie('c', 'hello')
request = HttpRequest() request = HttpRequest()

View File

@ -73,7 +73,7 @@ class UpdateOnlyFieldsTests(TestCase):
with self.assertNumQueries(1): with self.assertNumQueries(1):
s1.save() s1.save()
# Test that the deferred class does not remember that gender was # Test that the deferred class does not remember that gender was
# set, instead the instace should remember this. # set, instead the instance should remember this.
s1 = Person.objects.only('name').get(pk=s.pk) s1 = Person.objects.only('name').get(pk=s.pk)
with self.assertNumQueries(1): with self.assertNumQueries(1):
s1.save() s1.save()

View File

@ -56,7 +56,7 @@ class BaseModelValidationTests(ValidationTestCase):
mtv = ModelToValidate(number=10, name='Some Name', url='not a url') mtv = ModelToValidate(number=10, name='Some Name', url='not a url')
self.assertFieldFailsValidationWithMessage(mtv.full_clean, 'url', ['Enter a valid URL.']) self.assertFieldFailsValidationWithMessage(mtv.full_clean, 'url', ['Enter a valid URL.'])
def test_text_greater_that_charfields_max_length_raises_erros(self): def test_text_greater_that_charfields_max_length_raises_errors(self):
mtv = ModelToValidate(number=10, name='Some Name' * 100) mtv = ModelToValidate(number=10, name='Some Name' * 100)
self.assertFailsValidation(mtv.full_clean, ['name']) self.assertFailsValidation(mtv.full_clean, ['name'])