Ignore:
Timestamp:
Apr 23, 2007 3:37:06 PM (8 years ago)
Author:
olivier <>
Branches:
master, crem, crem2, crem3, dev, dev2, diadems, dj1.6, feature/breadcrumbs, feature/ts-0.5, feature/ts-0.5.4, feature/writecache, forma, generic, instru_search, lam, lam2, mapsv3, merge, nlivemulti, prob, production, release/1.4.4, sabiod, search, security, server, social, storage, telecaster, test, video
Children:
9ccc928
Parents:
e789173
git-author:
olivier <> (23/04/2007 15:37:06)
git-committer:
olivier <> (23/04/2007 15:37:06)
Message:

web interface: added quick search and fixed export download

File:
1 edited

Legend:

Unmodified
Added
Removed
  • telemeta/views/web.py

    r6d9a741 r77469e8  
    55from django.http import Http404 
    66from telemeta.models import MediaItem 
     7from telemeta.models import MediaCollection 
    78from django.shortcuts import render_to_response 
    89import re 
     
    6869        outfile = exporter.process(item.id, infile, metadata, []) 
    6970 
    70         return HttpResponse(self.file_stream(outfile), mimetype = mime_type) 
     71        response = HttpResponse(self.file_stream(outfile), mimetype = mime_type) 
     72        response['Content-Disposition'] = 'attachment; filename="download.' + \ 
     73                    exporter.get_file_extension() + '"' 
     74        return response 
     75 
     76    def quick_search(self, request): 
     77        pattern = request.REQUEST["pattern"] 
     78        collections = MediaCollection.objects.quick_search(pattern) 
     79        items = MediaItem.objects.quick_search(pattern) 
     80        return render_to_response('search_results.html',  
     81                    {'pattern': pattern, 'collections': collections,  
     82                     'items': items}) 
     83 
     84         
    7185 
    7286comp_mgr = ComponentManager() 
     
    7488item_detail = view.item_detail 
    7589item_export = view.item_export 
     90quick_search = view.quick_search 
    7691 
    7792def media_item_edit(request, media_item_id): 
Note: See TracChangeset for help on using the changeset viewer.