#29054: Unhashable type Point bug with multiple annotations
------------------------------------------+------------------------
               Reporter:  Lachlan Cannon  |          Owner:  nobody
                   Type:  Uncategorized   |         Status:  new
              Component:  GIS             |        Version:  2.0
               Severity:  Normal          |       Keywords:
           Triage Stage:  Unreviewed      |      Has patch:  0
    Needs documentation:  0               |    Needs tests:  0
Patch needs improvement:  0               |  Easy pickings:  0
                  UI/UX:  0               |
------------------------------------------+------------------------
 Simplified example to reproduce, with these models:

 {{{#!python
 class State(models.Model):
     name = models.CharField(max_length=100)

 class Location(models.Model):
     name = models.CharField(max_length=100)
     location = models.PointField(geography=True)
     state = models.ForeignKey(State, on_delete=models.CASCADE)
 }}}

 Running the following code works fine in 2.0 (assuming you have a few
 models set up):

 {{{#!python
 State.objects.annotate(distance=Distance('locality__location',
 Locality.objects.first().location))
 }}}

 But this code works in 1.11, and fails in 2.0.1 with TypeError: unhashable
 type: 'Point':

 {{{#!python
 State.objects.annotate(distance=Distance('locality__location',
 self.locality.location)).annotate(count=Count('locality'))
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29054>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.d21450f7da3cc8808825edc728496bde%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to