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):
|
class AreaField(models.FloatField):
|
||||||
"Wrapper for Area values."
|
"Wrapper for Area values."
|
||||||
def __init__(self, area_att=None):
|
def __init__(self, area_att=None):
|
||||||
|
super().__init__()
|
||||||
self.area_att = area_att
|
self.area_att = area_att
|
||||||
|
|
||||||
def get_prep_value(self, value):
|
def get_prep_value(self, value):
|
||||||
|
@ -40,6 +41,7 @@ class AreaField(models.FloatField):
|
||||||
class DistanceField(models.FloatField):
|
class DistanceField(models.FloatField):
|
||||||
"Wrapper for Distance values."
|
"Wrapper for Distance values."
|
||||||
def __init__(self, distance_att=None):
|
def __init__(self, distance_att=None):
|
||||||
|
super().__init__()
|
||||||
self.distance_att = distance_att
|
self.distance_att = distance_att
|
||||||
|
|
||||||
def get_prep_value(self, value):
|
def get_prep_value(self, value):
|
||||||
|
|
|
@ -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