Ejemplo n.º 1
0
def refresh_pdb_ajax(request, owner_id, sub_id ):
    pdblist = [ b.pdb_code.lower() for b in PdbRef.objects.all() ]
    subobj = get_object_or_404( Submission, pk = sub_id )
    owned_list = subobj.pdbref_set.all()
    ownobj = get_object_or_404( Owner, myt_id = owner_id ) 
    olist = [ b.pdb_code.lower() for b in owned_list ]
    if request.POST.has_key('client_response') and request.POST['client_response'].lower() != '':
	client_response = request.POST['client_response'].lower()
	if client_response in pdblist:
	    p = PdbRef.objects.get( pdb_code = client_response )
	    p.get_descriptors()
	    p.get_release_status()
	    p.save()
	    response_dict = { 'server_response' : p.title }
	    if p.pdb_code.lower() not in olist:
		sp =  SubPdb.objects.create( submission = subobj, pdbref = p, trigger_release = True, release_override = False )
		p.save()
		subobj.save() 
	else:
	    p = PdbRef(  pdb_code = client_response )
	    p.get_descriptors()
	    p.get_release_status()
	    p.save()
	    response_dict = { 'server_response' : p.title }
	    sp =  SubPdb.objects.create( submission = subobj, pdbref = p, trigger_release = True, release_override = False )
	    p.save()
	    subobj.save()
        context = { 'submission' : subobj, 'owner' : ownobj  }
	return HttpResponse(render(request, 'subform/refresh_form_pdb.html', context) ) 
    else:
        context = { 'submission' : subobj, 'owner' : ownobj  }
	return HttpResponse(render(request, 'subform/refresh_form_pdb.html', context) ) 
Ejemplo n.º 2
0
    def test_pdb_obtain(self):
        pdblist = [ b.pdb_code.lower() for b in PdbRef.objects.all() ]
	p1 = PdbRef( pdb_code = '1fvk' )
	p2 = PdbRef( pdb_code = '3h93' )
	p1.get_descriptors()
	p1.get_release_status()
	p2.get_descriptors()	
	p2.get_release_status()
        pdblist = [ b.pdb_code.lower() for b in PdbRef.objects.all() ]
	for p in ( p1, p2 ):
	    if p not in self.subobj.pdbref_set.all():
		p.save()	
		sp = SubPdb.objects.create( submission = self.subobj, pdbref = p, trigger_release = True, release_override = True ) 
		#p.submission.add( self.subobj )
		#p.save()
		self.subobj.save()