Skip to content

Commit

Permalink
Merge pull request #19 from jciskey/patch-2
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
shabda committed Feb 27, 2018
2 parents 06bf13b + f30ec4c commit 7a618a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/sorting_calculated_fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ How to enable sorting on calculated fields?
===========================================================

Django adds sorting capabilities on fields which are attributes on the models.
When you add a calculated field Django doesn't know how to do a :code:`order_by`, so it doesn't a sorting capability on that field.
When you add a calculated field Django doesn't know how to do a :code:`order_by`, so it doesn't add sorting capability on that field.

If you want to add sorting on a calculated field, you have to tell Django, what to pass to :code:`order_by`. You can do this by setting
If you want to add sorting on a calculated field, you have to tell Django what to pass to :code:`order_by`. You can do this by setting the
:code:`admin_order_field` attribute on the calculated field method.

You start from the admin you wrote in the pervious chapter (:doc:`optimize_queries`).::
You start from the admin you wrote in the previous chapter (:doc:`optimize_queries`).::

hero_count.admin_order_field = '_hero_count'
villain_count.admin_order_field = '_villain_count'
Expand Down

0 comments on commit 7a618a1

Please sign in to comment.