def logo_img(self, obj): res = "" if obj.logo: res = blob_to_image_tag(obj.logo, height=50) if not res: res = _("No Logo") return res
def stations_tab(request): stations_data = [] for station in Station.objects.filter(show_on_list=True): stations_data.append( { "name": station.name, "description": station.description, "phones": u"|".join([p.local_phone for p in station.phones.all()]), "website": station.website_url, "address": u"%s, %s" % (station.address, station.city.name), "logo": blob_to_image_tag(station.logo), "station_page_url": station.get_station_page_link() if station.subdomain_name else "", } ) return custom_render_to_response("stations.html", locals(), context_instance=RequestContext(request))
def stations_tab(request): stations_data = [] for station in Station.objects.filter(show_on_list=True): stations_data.append({ "name": station.name, "description": station.description, "phones": u"|".join([p.local_phone for p in station.phones.all()]), "website": station.website_url, "address": u"%s, %s" % (station.address, station.city.name), "logo": blob_to_image_tag(station.logo), "station_page_url": station.get_station_page_link() if station.subdomain_name else "" }) return custom_render_to_response("stations.html", locals(), context_instance=RequestContext(request))
def station_page(request, subdomain_name): station = get_object_or_404(models.Station, subdomain_name=subdomain_name) ua = request.META.get("HTTP_USER_AGENT", "").lower() if station.market_app_url and ua.find("android") > -1: ga_hit_page(request) return HttpResponseRedirect(station.market_app_url) elif station.itunes_app_url and ua.find("iphone") > -1: ga_hit_page(request) return HttpResponseRedirect(station.itunes_app_url) passenger = Passenger.from_request(request) if passenger and passenger.business: return station_business_page(request, subdomain_name) if not request.mobile and CURRENT_PASSENGER_KEY in request.session: del request.session[CURRENT_PASSENGER_KEY] page_specific_class = "station_page" hidden_fields = HIDDEN_FIELDS form = OrderForm() not_a_user, not_a_passenger = NOT_A_USER, NOT_A_PASSENGER waze_token = settings.WAZE_API_TOKEN telmap_user = settings.TELMAP_API_USER telmap_password = settings.TELMAP_API_PASSWORD telmap_languages = 'he' if str(get_language_from_request(request)) == 'he' else 'en' country_code = settings.DEFAULT_COUNTRY_CODE station_full_name = _("%s Taxi station") % station.name website_link = station.get_station_page_link() pretty_website_link = website_link.replace("http://", "") station_logo = blob_to_image_tag(station.logo) if not passenger and request.GET.get("show_login", False): show_login = True return custom_render_to_response("station_page.html", locals(), context_instance=RequestContext(request))
def blob_to_img(blob_data): return blob_to_image_tag(blob_data)
def render(self, name, value, attrs=None): result = super(AppEngineImageWidget, self).render(name, None, attrs=attrs) if value: result = blob_to_image_tag(value, height=80) return result