示例#1
0
def displayHardware(request, id, name):
    """Display a hardware"""
    hardware = get_object_or_404(Hardware, id=id)
    context = {'hardware': hardware}
    if request.user.is_authenticated():
        if hardware.owner != request.user and hardware.location != None and request.user.get_profile(
        ).location != None:
            hardwarelocation = hardware.location
            userlocation = request.user.get_profile().location
            context["distance"] = util.get_distance_string(
                hardwarelocation, userlocation)
    if hardware.owner.get_profile().displayLocation or request.user.is_staff:
        map, showmap = util.create_map(hardware.location, (500, 300))
        context["map"] = map
        context["showmap"] = showmap
    images = MultiuploaderImage.objects.filter(hardware=hardware.id)
    context["images"] = images
    if hardware.lendlengthtype != None:
        lendlengthtypes = {
            '1': 'Tag(e)',
            '7': 'Woche(n)',
            '30': 'Monat(e)',
            '356': 'Jahr(e)'
        }
        context["lendlengthtype"] = lendlengthtypes[str(
            hardware.lendlengthtype)]
    return render_to_response('hardware/hardwareview.html', context,
                              RequestContext(request))
示例#2
0
def displayHardware(request, id, name):
	"""Display a hardware"""
	hardware = get_object_or_404(Hardware, id=id)
	context = {'hardware':hardware}
	if request.user.is_authenticated():
		if hardware.owner != request.user and hardware.location != None and request.user.get_profile().location != None:
			hardwarelocation = hardware.location
			userlocation = request.user.get_profile().location
			context["distance"] = util.get_distance_string(hardwarelocation, userlocation)
	if hardware.owner.get_profile().displayLocation  or request.user.is_staff:
		map, showmap = util.create_map(hardware.location, (500, 300))
		context["map"] = map
		context["showmap"] = showmap
	images = MultiuploaderImage.objects.filter(hardware=hardware.id)
	context["images"] = images
	return render_to_response('hardware/hardwareview.html', context, RequestContext(request))
示例#3
0
def displayHardware(request, id, name):
    """Display a hardware"""
    hardware = get_object_or_404(Hardware, id=id)
    context = {"hardware": hardware}
    if request.user.is_authenticated():
        if hardware.owner != request.user and hardware.location != None and request.user.get_profile().location != None:
            hardwarelocation = hardware.location
            userlocation = request.user.get_profile().location
            context["distance"] = util.get_distance_string(hardwarelocation, userlocation)
    if hardware.owner.get_profile().displayLocation or request.user.is_staff:
        map, showmap = util.create_map(hardware.location, (500, 300))
        context["map"] = map
        context["showmap"] = showmap
    images = MultiuploaderImage.objects.filter(hardware=hardware.id)
    context["images"] = images
    if hardware.lendlengthtype != None:
        lendlengthtypes = {"1": "Tag(e)", "7": "Woche(n)", "30": "Monat(e)", "356": "Jahr(e)"}
        context["lendlengthtype"] = lendlengthtypes[str(hardware.lendlengthtype)]
    return render_to_response("hardware/hardwareview.html", context, RequestContext(request))
示例#4
0
 def get_distance_string(self, destination):
     return get_distance_string(self, destination)
	def get_distance_string(self, destination):
		return get_distance_string(self, destination)