mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #8291 -- Allowed 'pk' to be used as an ordering option in Model.Meta. Thanks to peterd12 for the report and to evan_schulz, gruszczy, frog32 and David Gouldin for their work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17445 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -283,6 +283,11 @@ def get_validation_errors(outfile, app=None):
|
||||
# this format would be nice, but it's a little fiddly).
|
||||
if '__' in field_name:
|
||||
continue
|
||||
# Skip ordering on pk, this is always a valid order_by field
|
||||
# but is an alias and therefore won't be found by
|
||||
# opts.get_field.
|
||||
if field_name == 'pk':
|
||||
continue
|
||||
try:
|
||||
opts.get_field(field_name, many_to_many=False)
|
||||
except models.FieldDoesNotExist:
|
||||
|
||||
Reference in New Issue
Block a user