Quantcast
Channel: Using Factory Boy with GeoDjango PointFields - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Answer by vikki for Using Factory Boy with GeoDjango PointFields

$
0
0

You can also set the value directly.

import jsonfrom factory import LazyAttributefrom factory.django import DjangoModelFactoryclass PlaceFactory(DjangoModelFactory):    static_location = "{'type': 'Point', 'coordinates': [1,1]}"    random_location = LazyAttribute(lambda x: json.dumps({'type': 'Point','coordinates': [random.uniform(-180.0, 180.0), random.uniform(-180.0, 180.0)]}    ))

Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>