Created view for whydatacenterlight page
This commit is contained in:
		
					parent
					
						
							
								2c1c36cf94
							
						
					
				
			
			
				commit
				
					
						1311e7ea89
					
				
			
		
					 1 changed files with 22 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -179,6 +179,28 @@ class BetaProgramView(CreateView):
 | 
			
		|||
        return HttpResponseRedirect(self.get_success_url())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class WhyDataCenterLightView(CreateView):
 | 
			
		||||
    template_name = "datacenterlight/whydatacenterlight.html"
 | 
			
		||||
    model = BetaAccess
 | 
			
		||||
    form_class = BetaAccessForm
 | 
			
		||||
    @cache_control(no_cache=True, must_revalidate=True, no_store=True)
 | 
			
		||||
    def get(self, request, *args, **kwargs):
 | 
			
		||||
        try:
 | 
			
		||||
            manager = OpenNebulaManager()
 | 
			
		||||
            templates = manager.get_templates()
 | 
			
		||||
            context = {
 | 
			
		||||
                'templates': VirtualMachineTemplateSerializer(templates, many=True).data,
 | 
			
		||||
            }
 | 
			
		||||
        except:
 | 
			
		||||
            messages.error( request,
 | 
			
		||||
                'We have a temporary problem to connect to our backend. \
 | 
			
		||||
                Please try again in a few minutes'
 | 
			
		||||
                )
 | 
			
		||||
            context = {
 | 
			
		||||
                'error' : 'connection'
 | 
			
		||||
                    }
 | 
			
		||||
        return render(request, self.template_name, context)    
 | 
			
		||||
 | 
			
		||||
class IndexView(CreateView):
 | 
			
		||||
    template_name = "datacenterlight/index.html"
 | 
			
		||||
    model = BetaAccess
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue