File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
tests/modeltests/invalid_models Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ def get_validation_errors(outfile, app=None):
257257 continue
258258 # Skip ordering in the format field1__field2 (FIXME: checking
259259 # this format would be nice, but it's a little fiddly).
260- if '_ ' in field_name :
260+ if '__ ' in field_name :
261261 continue
262262 try :
263263 opts .get_field (field_name , many_to_many = False )
Original file line number Diff line number Diff line change @@ -206,6 +206,9 @@ class UniqueFKTarget2(models.Model):
206206 """ Model to test for unique FK target in previously seen model: expect no error """
207207 tgt = models .ForeignKey (FKTarget , to_field = 'good' )
208208
209+ class NonExistingOrderingWithSingleUnderscore (models .Model ):
210+ class Meta :
211+ ordering = ("does_not_exist" ,)
209212
210213model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "max_length" attribute that is a positive integer.
211214invalid_models.fielderrors: "charfield2": CharFields require a "max_length" attribute that is a positive integer.
@@ -311,4 +314,5 @@ class UniqueFKTarget2(models.Model):
311314invalid_models.uniquem2m: ManyToManyFields cannot be unique. Remove the unique argument on 'unique_people'.
312315invalid_models.nonuniquefktarget1: Field 'bad' under model 'FKTarget' must have a unique=True constraint.
313316invalid_models.nonuniquefktarget2: Field 'bad' under model 'FKTarget' must have a unique=True constraint.
317+ invalid_models.nonexistingorderingwithsingleunderscore: "ordering" refers to "does_not_exist", a field that doesn't exist.
314318"""
You can’t perform that action at this time.
0 commit comments