예제 #1
0
 def test_translate(self):
     """
     Testing Translate() function on Z values.
     """
     self._load_city_data()
     ztranslations = (5.23, 23, -17)
     for ztrans in ztranslations:
         for city in City3D.objects.annotate(translate=Translate('point', 0, 0, ztrans)):
             self.assertEqual(city_dict[city.name][2] + ztrans, city.translate.z)
예제 #2
0
def translate(r, direction):
    return (Restaurant.objects.filter(pk=r.pk).annotate(new_del_area=Translate(
        'delivery_area', direction[0], direction[1])).first())