mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed deepcopy of AreaField and DistanceField.
This commit is contained in:
parent
0c4ac12a7b
commit
0ab1dc0a8b
@ -11,6 +11,7 @@ from django.db import models
|
||||
class AreaField(models.FloatField):
|
||||
"Wrapper for Area values."
|
||||
def __init__(self, area_att=None):
|
||||
super().__init__()
|
||||
self.area_att = area_att
|
||||
|
||||
def get_prep_value(self, value):
|
||||
@ -40,6 +41,7 @@ class AreaField(models.FloatField):
|
||||
class DistanceField(models.FloatField):
|
||||
"Wrapper for Distance values."
|
||||
def __init__(self, distance_att=None):
|
||||
super().__init__()
|
||||
self.distance_att = distance_att
|
||||
|
||||
def get_prep_value(self, value):
|
||||
|
15
tests/gis_tests/test_fields.py
Normal file
15
tests/gis_tests/test_fields.py
Normal file
@ -0,0 +1,15 @@
|
||||
import copy
|
||||
|
||||
from django.contrib.gis.db.models.sql import AreaField, DistanceField
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
|
||||
class FieldsTests(SimpleTestCase):
|
||||
|
||||
def test_area_field_deepcopy(self):
|
||||
field = AreaField()
|
||||
self.assertEqual(copy.deepcopy(field), field)
|
||||
|
||||
def test_distance_field_deepcopy(self):
|
||||
field = DistanceField()
|
||||
self.assertEqual(copy.deepcopy(field), field)
|
Loading…
Reference in New Issue
Block a user