Compare geographic value of data with its initial value.
(self, initial, data)
| 92 | return geom |
| 93 | |
| 94 | def has_changed(self, initial, data): |
| 95 | """Compare geographic value of data with its initial value.""" |
| 96 | |
| 97 | try: |
| 98 | data = self.to_python(data) |
| 99 | initial = self.to_python(initial) |
| 100 | except ValidationError: |
| 101 | return True |
| 102 | |
| 103 | # Only do a geographic comparison if both values are available |
| 104 | if initial and data: |
| 105 | data.transform(initial.srid) |
| 106 | # If the initial value was not added by the browser, the geometry |
| 107 | # provided may be slightly different, the first time it is saved. |
| 108 | # The comparison is done with a very low tolerance. |
| 109 | return not initial.equals_exact(data, tolerance=0.000001) |
| 110 | else: |
| 111 | # Check for change of state of existence |
| 112 | return bool(initial) != bool(data) |
| 113 | |
| 114 | |
| 115 | class GeometryCollectionField(GeometryField): |
nothing calls this directly
no test coverage detected