Ticket #14513: django-14513-e62b9ba4e02c.diff
File django-14513-e62b9ba4e02c.diff, 2.0 KB (added by , 14 years ago) |
---|
-
django/core/management/validation.py
# HG changeset patch -- Bitbucket.org # Project django-14513 # URL http://bitbucket.org/vanschelven/django-14513/overview # User Klaas van Schelven <klaas@vanschelven.com> # Date 1287593945 -7200 # Node ID e62b9ba4e02c09e71443d711946981adc30e0745 # Parent eada92bd16c9d21442b21b4fbfb49e811df20c50 Fix for Ticket #14513, including test
a b def get_validation_errors(outfile, app=N 257 257 continue 258 258 # Skip ordering in the format field1__field2 (FIXME: checking 259 259 # this format would be nice, but it's a little fiddly). 260 if '_ ' in field_name:260 if '__' in field_name: 261 261 continue 262 262 try: 263 263 opts.get_field(field_name, many_to_many=False) -
tests/modeltests/invalid_models/models.py
a b class UniqueFKTarget2(models.Model): 206 206 """ Model to test for unique FK target in previously seen model: expect no error """ 207 207 tgt = models.ForeignKey(FKTarget, to_field='good') 208 208 209 class NonExistingOrderingWithSingleUnderscore(models.Model): 210 class Meta: 211 ordering = ("does_not_exist",) 209 212 210 213 model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "max_length" attribute that is a positive integer. 211 214 invalid_models.fielderrors: "charfield2": CharFields require a "max_length" attribute that is a positive integer. … … invalid_models.abstractrelationmodel: 'f 311 314 invalid_models.uniquem2m: ManyToManyFields cannot be unique. Remove the unique argument on 'unique_people'. 312 315 invalid_models.nonuniquefktarget1: Field 'bad' under model 'FKTarget' must have a unique=True constraint. 313 316 invalid_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. 314 318 """