diff --git a/datacenterlight/templates/datacenterlight/order.html b/datacenterlight/templates/datacenterlight/order.html index ab224172..61ab149a 100644 --- a/datacenterlight/templates/datacenterlight/order.html +++ b/datacenterlight/templates/datacenterlight/order.html @@ -1,5 +1,7 @@ +{% load staticfiles i18n%} +{% get_current_language as LANGUAGE_CODE %} - + @@ -9,19 +11,24 @@ - Rails Hosting.ch - Ruby on Rails as easy as possible + datacenterlight.ch - Featherlight Swiss VM - + - - + + - - - - + + + + + + + + + @@ -36,7 +43,7 @@ +
- - - -
-
-
 
- -
-

-

Order Now

-

 

- -
-   -
- - - -
- -

 

- -
-
-   -
- - - -
-

VM size sliders to be inserted

- - -
- - -
-
- - -
- - -

-
    - -
 
-
-
-
- +
+

{% trans "We are cutting down the costs significantly!" %}

- - +
- + +
+
+ +
+
+ {% csrf_token %} + +
+

{% trans "VM hosting" %}

+
+
+ 15 + CHF +
+
+
+

{% trans "Hosted in Switzerland" %}

+
+
+ + + Core + +
+
+ + + GB RAM + +
+
+ + + {% trans "GB Storage (SSD)" %} + +
+ + +
+ + +
+ + + +
+ + +
+
+ + +
+
+ + +
+
+
+ +
+

{% trans "Simple and affordable: Try our virtual machine with featherlight price." %}

+ +
+

Our VMs are hosted in Glarus, Switzerland. WARNING: We are currently running in BETA mode, especially our website We hope you will not encounter any hiccups, but if you, please let us know at support@datacenterlight.ch

+
+
+
+ + +
- + + + + + - + + diff --git a/datacenterlight/templates/datacenterlight/pricing.html b/datacenterlight/templates/datacenterlight/pricing.html index e7b8811b..da13d5e1 100644 --- a/datacenterlight/templates/datacenterlight/pricing.html +++ b/datacenterlight/templates/datacenterlight/pricing.html @@ -1,7 +1,7 @@ {% load staticfiles i18n%} {% get_current_language as LANGUAGE_CODE %} - + diff --git a/datacenterlight/templates/datacenterlight/success.html b/datacenterlight/templates/datacenterlight/success.html index ce53aa02..bf7f982a 100644 --- a/datacenterlight/templates/datacenterlight/success.html +++ b/datacenterlight/templates/datacenterlight/success.html @@ -1,7 +1,7 @@ {% load staticfiles i18n%} {% get_current_language as LANGUAGE_CODE %} - + diff --git a/datacenterlight/urls.py b/datacenterlight/urls.py index 8713165f..c3f9f98d 100644 --- a/datacenterlight/urls.py +++ b/datacenterlight/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import url -from .views import IndexView, BetaProgramView, LandingProgramView, BetaAccessView, PricingView, SuccessView +from .views import IndexView, BetaProgramView, LandingProgramView, BetaAccessView, PricingView, SuccessView, OrderView urlpatterns = [ @@ -8,6 +8,7 @@ urlpatterns = [ url(r'^/beta-program/?$', BetaProgramView.as_view(), name='beta'), url(r'^/landing/?$', LandingProgramView.as_view(), name='landing'), url(r'^/pricing/?$', PricingView.as_view(), name='pricing'), - url(r'^/pricing-success/?$', SuccessView.as_view(), name='success'), + url(r'^/order/?$', OrderView.as_view(), name='order'), + url(r'^/order-success/?$', SuccessView.as_view(), name='success'), url(r'^/beta_access?$', BetaAccessView.as_view(), name='beta_access'), ] diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 24c2b4d5..e2673f8c 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -66,6 +66,54 @@ class PricingView(TemplateView): return redirect(reverse('hosting:payment')) +class OrderView(TemplateView): + template_name = "datacenterlight/order.html" + + 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 could not load the VM templates due to a backend connection \ + error. Please try again in a few minutes' + ) + context = { + 'error' : 'connection' + } + + return render(request, self.template_name, context) + + + def post(self, request): + + cores = request.POST.get('cpu') + memory = request.POST.get('ram') + storage = request.POST.get('storage') + price = request.POST.get('total') + + template_id = int(request.POST.get('config')) + + manager = OpenNebulaManager() + template = manager.get_template(template_id) + + request.session['template'] = VirtualMachineTemplateSerializer(template).data + + if not request.user.is_authenticated(): + request.session['next'] = reverse('hosting:payment') + + request.session['specs'] = { + 'cpu':cores, + 'memory': memory, + 'disk_size': storage, + 'price': price, + } + + return redirect(reverse('hosting:payment')) class BetaAccessView(FormView): template_name = "datacenterlight/beta_access.html"