示例#1
0
文件: inventory.py 项目: VPAC/lintory
    def render(self, context):
        result = self.result
        location = self.location.resolve(context)

        web = webs.location_web()
        context[result] = web.has_svg_file(location)
        return ''
示例#2
0
文件: inventory.py 项目: VPAC/lintory
def show_location_list(context, object_list, sort="location_sort"):
    request = context['request']
    web = webs.location_web()
    dict = defaults(context)
    dict['table'] = tables.location(request, web, object_list,request.GET.get(sort))
    dict['rows'] = dict['table'].rows
    dict['web'] = web
    dict['sort'] = sort
    return dict
示例#3
0
文件: views.py 项目: VPAC/lintory
def location_svg(request, object_id):
    object = get_object_or_404(models.location, pk=object_id)

    web = webs.location_web()
    if not web.has_svg_file(object):
        raise Http404

    return render_to_response('lintory/locations/%i.svg'%object.pk,
        mimetype= "image/svg+xml",
        context_instance=RequestContext(request,{
                    'location': location_lookup()
                }))
示例#4
0
文件: views.py 项目: VPAC/lintory
def location_task_list(request, object_id):
    web = webs.location_web()
    object = get_object_or_404(models.location, pk=object_id)

    breadcrumbs = web.get_view_breadcrumbs(object)
    breadcrumbs.append(webs.breadcrumb(reverse('location_task_list',kwargs={'object_id':object_id}),"tasks"))

    return render_to_response('lintory/location_tasks.html', {
            'object': object,
            'breadcrumbs': breadcrumbs,
            'todo_hardware_tasks': 
                models.hardware_task.objects.filter(hardware__in=object.get_self_or_children_hardware(),date_complete__isnull=True),
            },context_instance=RequestContext(request))
示例#5
0
文件: views.py 项目: VPAC/lintory
 def url(self):
     web = webs.location_web()
     return web.get_view_url(self.location)
示例#6
0
文件: views.py 项目: VPAC/lintory
def location_delete(request,object_id):
    web = webs.location_web()
    object = get_object_or_404(models.location, pk=object_id)
    return web.object_delete(request, object)
示例#7
0
文件: views.py 项目: VPAC/lintory
def location_add(request, object_id):
    web = webs.location_web()
    parent = get_object_or_404(models.location, pk=object_id)
    return web.object_add(request, kwargs={ 'parent': parent })