source: mauRepo/MolesManager/trunk/src/MolesManager/views/cedaObservationView.py @ 8089

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/MolesManager/views/cedaObservationView.py@8089
Revision 8089, 1018 bytes checked in by mnagni, 8 years ago (diff)

Played with DOJO
New EA library
Addede CEDA_Process to the migration

Line 
1'''
2Created on 1 Nov 2011
3
4@author: mnagni
5'''
6from django.shortcuts import render_to_response
7from django.core.context_processors import csrf
8from MolesManager.forms.commons import ObjectById
9from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation
10from MolesManager.moles3epb import Moles3EPB
11from MolesManager.djencoder import DJEncoder
12
13
14def __getSample(request, objectId, c):
15    '''
16    @param request: an HttpRequest
17    @param objectId: an istance of ObjectById 
18    '''
19    if request.POST.has_key('obs_id'):
20        dp = Moles3EPB.search(CEDA_Observation, request.POST['obs_id'], request.moles_session)
21        c['records'] = dp
22
23def coView(request):
24    c = {}
25    objectId = ObjectById(request.POST or None)
26    __getSample(request, objectId, c)
27    if c.has_key('records'):
28        c['coObs'] = DJEncoder().encode(c['records'])
29        print c['coObs'] 
30    c['objId'] = objectId
31   
32    c.update(csrf(request))
33    return render_to_response('cedaObservation.html', c)
Note: See TracBrowser for help on using the repository browser.