コード例 #1
0
 def test_render_returns_blank_for_value_when_none(self):
     widget = GoogleMapsAddressWidget()
     results = widget.render('name', None, attrs={'a1': 1, 'a2': 2})
     expected = '<input a1="1" a2="2" name="name" type="text" />'
     expected += '<div class="map_canvas_wrapper">'
     expected += '<div id="map_canvas"></div></div>'
     self.assertEqual(expected, results)
コード例 #2
0
 def test_render_returns_xxxxxxx(self):
     widget = GoogleMapsAddressWidget()
     results = widget.render('name', 'value', attrs={'a1': 1, 'a2': 2})
     expected = '<input a1="1" a2="2" name="name" type="text" value="value" />'
     expected += '<div class="map_canvas_wrapper">'
     expected += '<div id="map_canvas"></div></div>'
     self.assertHTMLEqual(expected, results)
コード例 #3
0
 def test_render_returns_xxxxxxx(self):
     widget = GoogleMapsAddressWidget()
     results = widget.render('name', 'value', attrs={'a1': 1, 'a2': 2})
     expected = '<input a1="1" a2="2" name="name" type="text" value="value" />'
     expected += '<div class="map_canvas_wrapper">'
     expected += '<div id="map_canvas"></div></div>'
     self.assertEqual(expected, results)
コード例 #4
0
 def test_render_returns_blank_for_value_when_none(self):
     widget = GoogleMapsAddressWidget()
     results = widget.render('name', None, attrs={'a1': 1, 'a2': 2})
     expected = '<input a1="1" a2="2" name="name" type="text" />'
     expected += '<div class="map_canvas_wrapper">'
     expected += '<div id="map_canvas"></div></div>'
     self.assertHTMLEqual(expected, results)
コード例 #5
0
ファイル: form.py プロジェクト: Jakeybaby/CapstoneProject
 class Meta:
     model = Order
     fields = ['employee_order', 'address', 'geolocation']
     widgets = {
         "address":
         GoogleMapsAddressWidget(
             attrs={
                 'data-map-type':
                 'roadmap',
                 'data-autocomplete-options':
                 json.dumps({
                     'types': ['geocode', 'establishment'],
                     'componentRestrictions': {
                         'country': 'NZ'
                     }
                 })
             }),
     }
コード例 #6
0
 def test_maps_js_uses_api_key(self):
     widget = GoogleMapsAddressWidget()
     google_maps_js = "https://maps.google.com/maps/api/js?key={}".format(
         settings.GOOGLE_MAPS_API_KEY)
     self.assertEqual(google_maps_js, widget.Media().js[1])
コード例 #7
0
ファイル: forms.py プロジェクト: nvoitovych/real_estate_site
 class Meta(object):
     model = Product
     fields = ['address', 'geolocation']
     widgets = {
         "address": GoogleMapsAddressWidget(attrs={'disabled': 'disabled'}),
     }