Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/MolesManager/views/cedaSearch.py@8211
Revision 8211,
1013 bytes
checked in by gparton, 9 years ago
(diff) |
Adding in Graham's amendments to ceda Obs views and js, plus search page content
|
Line | |
---|
1 | ''' |
---|
2 | Created on 1 Nov 2011 |
---|
3 | |
---|
4 | @author: mnagni |
---|
5 | ''' |
---|
6 | from django.shortcuts import render_to_response |
---|
7 | from django.core.context_processors import csrf |
---|
8 | from MolesManager.forms.commons import ObjectById |
---|
9 | from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation |
---|
10 | from MolesManager.moles3epb import Moles3EPB |
---|
11 | from MolesManager.djencoder import DJEncoder |
---|
12 | |
---|
13 | |
---|
14 | def __getSample(request, c): |
---|
15 | ''' |
---|
16 | @param request: an HttpRequest |
---|
17 | @param objectId: an instance of ObjectById |
---|
18 | ''' |
---|
19 | |
---|
20 | if request.POST.has_key('searchTerm'): |
---|
21 | print "got the post term. now to search" |
---|
22 | title = '%' + '' + '%' |
---|
23 | obs_with_title = request.moles_session.query(CEDA_Observation).filter(CEDA_Observation.identifier.code.like(title)) |
---|
24 | |
---|
25 | c['records'] = obs_with_title |
---|
26 | |
---|
27 | |
---|
28 | def coSearch(request): |
---|
29 | c = {} |
---|
30 | __getSample(request, c) |
---|
31 | if c.has_key('records'): |
---|
32 | c.update(csrf(request)) |
---|
33 | c.update(csrf(request)) |
---|
34 | return render_to_response('cedaSearch.html', c) |
---|
Note: See
TracBrowser
for help on using the repository browser.