diff -r 45a65187860f django/contrib/admin/views/main.py
a
|
b
|
|
716 | 716 | qs = qs.select_related() |
717 | 717 | break |
718 | 718 | |
| 719 | <<<<<<< local |
| 720 | # Calculate lookup_order_field. |
| 721 | # If the order-by field is a field with a relationship, order by the |
| 722 | # value in the related table. |
| 723 | lookup_order_field = self.order_field |
| 724 | try: |
| 725 | f = self.lookup_opts.get_field(self.order_field, many_to_many=False) |
| 726 | except models.FieldDoesNotExist: |
| 727 | pass |
| 728 | else: |
| 729 | if isinstance(f.rel, models.OneToOneRel): |
| 730 | # For OneToOneFields, don't try to order by the related object's ordering criteria. |
| 731 | pass |
| 732 | elif isinstance(f.rel, models.ManyToOneRel): |
| 733 | rel_ordering = f.rel.to._meta.ordering and f.rel.to._meta.ordering[0] or f.rel.to._meta.pk.column |
| 734 | lookup_order_field = '%s__%s' % (f.name, rel_ordering) |
| 735 | |
| 736 | ======= |
| 737 | >>>>>>> other |
719 | 738 | # Set ordering. |
720 | 739 | if self.order_field: |
721 | 740 | qs = qs.order_by('%s%s' % ((self.order_type == 'desc' and '-' or ''), self.order_field)) |
diff -r 45a65187860f django/core/management/__init__.py
a
|
b
|
|
194 | 194 | options, args = parser.parse_args(self.argv) |
195 | 195 | handle_default_options(options) |
196 | 196 | except: |
197 | | pass # Ignore any option errors at this point. |
| 197 | args = None # Ignore any option errors at this point. |
198 | 198 | |
199 | 199 | try: |
200 | 200 | subcommand = self.argv[1] |
… |
… |
|
203 | 203 | sys.exit(1) |
204 | 204 | |
205 | 205 | if subcommand == 'help': |
206 | | if len(args) > 2: |
| 206 | if not args is None and len(args) > 2: |
207 | 207 | self.fetch_command(args[2]).print_help(self.prog_name, args[2]) |
208 | 208 | else: |
209 | 209 | sys.stderr.write(self.main_help_text() + '\n') |