~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to django/contrib/gis/db/models/query.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2008-11-15 19:15:33 UTC
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20081115191533-84v2zyjbmp1074ni
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
605
605
        # set on the `GeoQuery` object of this queryset.
606
606
        if aggregate: self.query.aggregate = True
607
607
 
608
 
        # Is this operation going to be on a related geographic field?
609
 
        if not geo_field in self.model._meta.fields:
 
608
        opts = self.model._meta
 
609
        if not geo_field in opts.fields:
 
610
            # Is this operation going to be on a related geographic field?
610
611
            # If so, it'll have to be added to the select related information
611
612
            # (e.g., if 'location__point' was given as the field name).
612
613
            self.query.add_select_related([field_name])
613
614
            self.query.pre_sql_setup()
614
615
            rel_table, rel_col = self.query.related_select_cols[self.query.related_select_fields.index(geo_field)]
615
616
            return self.query._field_column(geo_field, rel_table)
 
617
        elif not geo_field in opts.local_fields:
 
618
            # This geographic field is inherited from another model, so we have to
 
619
            # use the db table for the _parent_ model instead.
 
620
            tmp_fld, parent_model, direct, m2m = opts.get_field_by_name(geo_field.name)
 
621
            return self.query._field_column(geo_field, parent_model._meta.db_table)
616
622
        else:
617
623
            return self.query._field_column(geo_field)