def get_mapa_propiedades(request): from realestate.propiedad.templatetags.extra_functions import currency listado_propiedades = [] for propiedad in Propiedad.objects.activas(): lat, lng = propiedad.coordenadas.split(',') try: im = get_thumbnail(propiedad.imagen_principal.imagen, '135x90', crop='center', quality=99).url except (ValueError, AttributeError): im = '' try: url = propiedad.get_absolute_url() except: url = '' listado_propiedades.append({ 'id': propiedad.id, 'url': url, 'street': propiedad.get_address(), 'title': propiedad.titulo, 'lat': lat, 'lng': lng, 'price': currency(propiedad.precio), 'img': im, }) return {'propiedades': listado_propiedades, }
def currency_price(self, propiedad): return currency(propiedad.precio)