Commits

Gianluca Pacchiella committed 18bf98f

Use defaults.

  • Participants
  • Parent commits 7e252c5

Comments (0)

Files changed (2)

File easy_maps/templatetags/easy_maps_tags.py

 from django import template
 from django.template.loader import render_to_string
 from easy_maps.models import Address
+from django.conf import settings
+
 register = template.Library()
 
 @register.tag
             address = self.address.resolve(context)
             template_name = self.template_name.resolve(context)
 
-            map, _ = Address.objects.get_or_create(address=address or '')
+            map = None
+            if address == '':
+                map = Address(latitude=settings.EASY_MAPS_CENTER[0], longitude=settings.EASY_MAPS_CENTER[1])
+            else:
+                map, _ = Address.objects.get_or_create(address=address)
+
             context.update({
                 'map': map,
                 'width': self.width,

File easy_maps_tests/settings.py

 #    'devserver',
     'south',
 )
+
+EASY_MAPS_CENTER = (45.0677201, 7.6825531)