wqMerge remote-tracking branch 'remotes/origin/feature/vm_pricing' into develop

Conflicts:
	dynamicweb/urls.py
This commit is contained in:
rascencio 2016-04-22 10:04:00 +02:00
commit f4fb538b9e
29 changed files with 990 additions and 441 deletions

View file

@ -5,6 +5,7 @@ from . import views
from .views import ContactView, IndexView, AboutView from .views import ContactView, IndexView, AboutView
urlpatterns = [ urlpatterns = [
url(r'', IndexView.as_view(), name='home'),
url(_(r'home/?$'), IndexView.as_view(), name='home'), url(_(r'home/?$'), IndexView.as_view(), name='home'),
url(_(r'about/?$'), AboutView.as_view(), name='about'), url(_(r'about/?$'), AboutView.as_view(), name='about'),
url(_(r'contact/?$'), ContactView.as_view(), name='contact'), url(_(r'contact/?$'), ContactView.as_view(), name='contact'),

View file

@ -5,7 +5,11 @@ from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static from django.conf.urls.static import static
from django.conf import settings from django.conf import settings
<<<<<<< HEAD
from hosting.views import railshosting, nodejshosting, djangohosting from hosting.views import railshosting, nodejshosting, djangohosting
=======
from hosting.views import RailsHostingView
>>>>>>> remotes/origin/feature/vm_pricing
from membership import urls as membership_urls from membership import urls as membership_urls
urlpatterns = [ urlpatterns = [
@ -13,6 +17,7 @@ urlpatterns = [
url(r'^railshosting/', railshosting, name="rails.hosting"), url(r'^railshosting/', railshosting, name="rails.hosting"),
url(r'^nodehosting/', nodejshosting, name="node.hosting"), url(r'^nodehosting/', nodejshosting, name="node.hosting"),
url(r'^djangohosting/', djangohosting, name="django.hosting"), url(r'^djangohosting/', djangohosting, name="django.hosting"),
url(r'^railshosting/', RailsHostingView.as_view(), name="rails.hosting"),
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')), url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
url(r'^jsi18n/(?P<packages>\S+?)/$', url(r'^jsi18n/(?P<packages>\S+?)/$',
'django.views.i18n.javascript_catalog'), 'django.views.i18n.javascript_catalog'),

View file

@ -1,4 +1,6 @@
from django.contrib import admin from django.contrib import admin
from .models import RailsBetaUser from .models import RailsBetaUser, VirtualMachineType
admin.site.register(RailsBetaUser) admin.site.register(RailsBetaUser)
admin.site.register(VirtualMachineType)

50
hosting/forms.py Normal file
View file

@ -0,0 +1,50 @@
from django import forms
from membership.models import CustomUser
from django.contrib.auth import authenticate
class HostingUserLoginForm(forms.Form):
email = forms.CharField(widget=forms.EmailInput())
password = forms.CharField(widget=forms.PasswordInput())
class Meta:
fields = ['email', 'password']
def clean(self):
email = self.cleaned_data.get('email')
password = self.cleaned_data.get('password')
is_auth = authenticate(email=email, password=password)
if not is_auth:
raise forms.ValidationError("Your username and/or password were incorrect.")
return self.cleaned_data
def clean_email(self):
email = self.cleaned_data.get('email')
try:
CustomUser.objects.get(email=email)
return email
except CustomUser.DoesNotExist:
raise forms.ValidationError("User does not exists")
else:
return email
class HostingUserSignupForm(forms.ModelForm):
confirm_password = forms.CharField(widget=forms.PasswordInput())
password = forms.CharField(widget=forms.PasswordInput())
class Meta:
model = CustomUser
fields = ['name', 'email', 'password']
widgets = {
'name': forms.TextInput(attrs={'placeholder': 'Enter your name or company name'}),
}
def clean_confirm_password(self):
password = self.cleaned_data.get('password')
confirm_password = self.cleaned_data.get('confirm_password')
if not confirm_password == password:
raise forms.ValidationError("Passwords don't match")
return confirm_password

View file

View file

View file

@ -0,0 +1,55 @@
from django.core.management.base import BaseCommand, CommandError
from hosting.models import VirtualMachineType
class Command(BaseCommand):
help = 'Create VM types'
def get_data(self):
hetzner = {
'base_price': 10,
'core_price': 10,
'memory_price': 10,
'disk_size_price': 10,
'description': 'VM auf einzelner HW, Raid1, kein HA'
}
return {
'hetzner_nug': {
'base_price': 5,
'memory_price': 2,
'core_price': 2,
'disk_size_price': 0.5,
'description': 'VM ohne Uptime Garantie'
},
'hetzner': hetzner,
'hetzner_raid6': {
'base_price': hetzner['base_price']*1.2,
'core_price': hetzner['core_price']*1.2,
'memory_price': hetzner['memory_price']*1.2,
'disk_size_price': hetzner['disk_size_price']*1.2,
'description': 'VM auf einzelner HW, Raid1, kein HA'
},
'hetzner_glusterfs': {
'base_price': hetzner['base_price']*1.4,
'core_price': hetzner['core_price']*1.4,
'memory_price': hetzner['memory_price']*1.4,
'disk_size_price': hetzner['disk_size_price']*1.4,
'description': 'VM auf einzelner HW, Raid1, kein HA'
},
'bern': {
'base_price': 12,
'core_price': 25,
'memory_price': 7,
'disk_size_price': 0.70,
'description': "VM in Bern, HA Setup ohne HA Garantie",
}
}
def handle(self, *args, **options):
data = self.get_data()
[VirtualMachineType.objects.create(hosting_company=key, **data[key])
for key in data.keys()]

View file

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 00:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hosting', '0002_railsbetauser'),
]
operations = [
migrations.CreateModel(
name='VirtualMachineTypes',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField()),
('base_price', models.FloatField()),
('memory_price', models.FloatField()),
('cores_price', models.FloatField()),
('disk_size_price', models.FloatField()),
('hosting_company', models.CharField(choices=[('hetzner_nug', 'Hetzner No Uptime Guarantee'), ('hetzner', 'Hetzner'), ('hetzner_raid6', 'Hetzner Raid6'), ('hetzner_glusterfs', 'Hetzner Glusterfs'), ('bern', 'Bern')], max_length=10)),
],
),
]

View file

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 00:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hosting', '0003_virtualmachinetypes'),
]
operations = [
migrations.RenameModel(
old_name='VirtualMachineTypes',
new_name='VirtualMachineType',
),
]

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 00:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hosting', '0004_auto_20160418_0034'),
]
operations = [
migrations.RenameField(
model_name='virtualmachinetype',
old_name='cores_price',
new_name='core_price',
),
]

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 01:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hosting', '0005_auto_20160418_0038'),
]
operations = [
migrations.AlterField(
model_name='virtualmachinetype',
name='hosting_company',
field=models.CharField(choices=[('hetzner_nug', 'Hetzner No Uptime Guarantee'), ('hetzner', 'Hetzner'), ('hetzner_raid6', 'Hetzner Raid6'), ('hetzner_glusterfs', 'Hetzner Glusterfs'), ('bern', 'Bern')], max_length=15),
),
]

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 01:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hosting', '0006_auto_20160418_0103'),
]
operations = [
migrations.AlterField(
model_name='virtualmachinetype',
name='hosting_company',
field=models.CharField(choices=[('hetzner_nug', 'Hetzner No Uptime Guarantee'), ('hetzner', 'Hetzner'), ('hetzner_raid6', 'Hetzner Raid6'), ('hetzner_glusterfs', 'Hetzner Glusterfs'), ('bern', 'Bern')], max_length=30),
),
]

View file

@ -1,4 +1,8 @@
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core import serializers
import json
class RailsBetaUser(models.Model): class RailsBetaUser(models.Model):
email = models.EmailField(unique=True) email = models.EmailField(unique=True)
@ -6,3 +10,56 @@ class RailsBetaUser(models.Model):
def __str__(self): def __str__(self):
return "%s - %s" % (self.email, self.received_date) return "%s - %s" % (self.email, self.received_date)
class VirtualMachineType(models.Model):
HETZNER_NUG = 'hetzner_nug'
HETZNER = 'hetzner'
HETZNER_R6 = 'hetzner_raid6'
HETZNER_G = 'hetzner_glusterfs'
BERN = 'bern'
HOSTING_TYPES = (
(HETZNER_NUG, 'Hetzner No Uptime Guarantee'),
(HETZNER, 'Hetzner'),
(HETZNER_R6, 'Hetzner Raid6'),
(HETZNER_G, 'Hetzner Glusterfs'),
(BERN, 'Bern'),
)
description = models.TextField()
base_price = models.FloatField()
memory_price = models.FloatField()
core_price = models.FloatField()
disk_size_price = models.FloatField()
hosting_company = models.CharField(max_length=30, choices=HOSTING_TYPES)
def __str__(self):
return "%s" % (self.get_hosting_company_display())
@classmethod
def get_serialized_vm_types(cls):
return [vm.get_serialized_data()
for vm in cls.objects.all()]
# return serializers.serialize("json",)
def defeault_price(self):
price = self.base_price
price += self.core_price
price += self.memory_price
price += self.disk_size_price * 10
return price
def get_serialized_data(self):
return {
'description': self.description,
'base_price': self.base_price,
'core_price': self.core_price,
'disk_size_price': self.disk_size_price,
'memory_price': self.memory_price,
'hosting_company_name': self.get_hosting_company_display(),
'hosting_company': self.hosting_company,
'default_price': self.defeault_price(),
'id': self.id,
}

View file

@ -31,7 +31,8 @@ h6 {
} }
.intro-header { .intro-header {
padding-top: 50px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */ height: 85%;
padding-top: 10%; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */
padding-bottom: 50px; padding-bottom: 50px;
text-align: center; text-align: center;
color: #f8f8f8; color: #f8f8f8;
@ -47,7 +48,8 @@ h6 {
background-size: cover; background-size: cover;
} }
.intro-header-2 { .intro-header-2 {
padding-top: 50px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */ height: 85%;
padding-top: 100px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */
padding-bottom: 50px; padding-bottom: 50px;
text-align: center; text-align: center;
color: #f8f8f8; color: #f8f8f8;

View file

@ -0,0 +1,95 @@
.pricing {
text-align: center;
border: 1px solid #f0f0f0;
color: #777;
font-size: 14px;
padding-left: 0;
margin-bottom: 30px;
font-family: 'Lato';
}
.pricing img {
display: block;
margin: auto;
width: 32px;
}
.pricing li:first-child,
.pricing li:last-child {
padding: 20px 13px;
}
.pricing li {
list-style: none;
padding: 13px;
}
.pricing li + li {
border-top: 1px solid #f0f0f0;
}
.pricing big {
font-size: 32px;
}
.pricing h3 {
margin-bottom: 0;
font-size: 36px;
}
.pricing span {
font-size: 12px;
color: #999;
font-weight: normal;
}
.pricing li:nth-last-child(2) {
padding: 30px 13px;
}
.pricing button {
width: auto;
margin: auto;
font-size: 15px;
font-weight: bold;
border-radius: 50px;
color: #fff;
padding: 9px 24px;
background: #aaa;
opacity: 1;
transition: opacity .2s ease;
border: none;
outline: none;
}
.pricing button:hover {
opacity: .9;
}
.pricing button:active {
box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1);
}
/* pricing color */
.p-green big,
.p-green h3 {
color: #4c7737;
}
.p-green button {
background: #4c7737;
}
.p-yel big,
.p-yel h3 {
color: #ffbb42;
}
.p-yel button {
background: #ffbb42;
}
.p-red big,
.p-red h3 {
color: #e13c4c;
}
.pricing .short-input{
min-width: 0;
width: 90px;
}
.p-red button {
background: #e13c4c;
}
.p-blue big,
.p-blue h3 {
color: #3f4bb8;
}
.p-blue button {
background: #3f4bb8;
}

View file

@ -0,0 +1,53 @@
$( document ).ready(function() {
//we need to load first VMTypesData from base.html django template
var pricingData = window.VMTypesData;
// Function to calculate the price given a vm type
function calculate_price(vm_type){
var ID_SELECTOR = "#";
var CURRENCY = "$";
var final_price_selector = ID_SELECTOR.concat(vm_type.concat('-final-price'));
var core_selector = ID_SELECTOR.concat(vm_type.concat('-cores'));
var memory_selector = ID_SELECTOR.concat(vm_type.concat('-memory'));
var disk_size_selector = ID_SELECTOR.concat(vm_type.concat('-disk_space'));
//Get vm type prices
var cores = $(core_selector).val();
var memory = $(memory_selector).val();
var disk_size = $(disk_size_selector).val();
var pricingData = eval(window.VMTypesData);
var company_prices = _.head(_.filter(pricingData, {hosting_company: vm_type}));
//Calculate final price
var price = company_prices.base_price;
price += company_prices.core_price*cores;
price += company_prices.memory_price*memory;
price += company_prices.disk_size_price*disk_size;
console.log(final_price_selector);
$(final_price_selector).text(price.toString().concat(CURRENCY));
}
//Listener function
function change_attribute(e){
var vm_type = this.getAttribute('data-vm-type');
calculate_price(vm_type);
}
//Listeners
$('.cores-selector').on('change',change_attribute);
$('.memory-selector').on('change',change_attribute);
$('.disk-space-selector').on('change',change_attribute);
console.log("mirame",window.VMTypesData);
});

View file

@ -13,12 +13,17 @@
<title>{{ domain }} - {{ hosting }} hosting as easy as possible</title> <title>{{ domain }} - {{ hosting }} hosting as easy as possible</title>
<!-- Bootstrap Core CSS --> <!-- Bootstrap Core CSS -->
<link href="{% static 'hosting/css/bootstrap.min.css' %}" rel="stylesheet"> <link href="{% static 'hosting/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'hosting/css/pricing.css' %}" rel="stylesheet">
<!-- Custom CSS --> <!-- Custom CSS -->
<link href="{% static 'hosting/css/landing-page.css' %}" rel="stylesheet"> <link href="{% static 'hosting/css/landing-page.css' %}" rel="stylesheet">
<!-- Custom Fonts --> <!-- Custom Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link href="{% static 'hosting/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css"> <link href="{% static 'hosting/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
@ -55,338 +60,67 @@
<body> <body>
<!-- Navigation --> <!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation"> {% include "hosting/includes/_navbar.html" %}
<div class="container topnav">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand topnav" href="#"><img src="{% static 'hosting/img/logo_black.svg' %}"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#how">How it works</a>
</li>
<li>
<a href="#your">Your infrastructure</a>
</li>
<li>
<a href="#our">Our inftrastructure</a>
</li>
<li>
<a href="#price">Pricing</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Header --> <!-- Header -->
<a name="about"></a> {% include "hosting/includes/_header.html" %}
<div class="intro-header">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-message">
<img class="responsive" src="{% static 'hosting/img/Beta.png' %}">
<h1>{{ domain }}</h1>
<h3>{{ hosting_long }} as easy as possible</h3>
<hr class="intro-divider">
<ul class="list-inline intro-social-buttons">
<li>
<a href="#howitworks" class="btn btn-default btn-lg"><i class="#Services"></i> <span class="network-name">how it works</span></a>
</li>
<li>
<a href="#own" class="btn btn-default btn-lg page-scroll"><span class="network-name">Let me start</span></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.intro-header -->
<!-- Page Content --> <!-- Page Content -->
<a name="how"></a> <a name="how"></a>
<div class="content-section-b">
<div class="container">
<div class="row">
<div class="col-lg-5 col-lg-offset-1 col-sm-push-6 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">How it works : </h2> <ul class="fa-ul">
{% block specification %}
{% endblock %}
</ul>
</div>
{% with 'hosting/img/card-'|add:hosting|add:'.png' as image_static %}
<div class="col-lg-5 col-sm-pull-6 col-sm-6">
<img class="img-responsive" src="{% static image_static %}" alt="">
</div>
{% endwith %}
</div>
</div>
<!-- /.container -->
<!-- /.option 1 -->
</div>
<a name="your"></a>
<div class="content-section-a" id="own">
<div class="container">
<div class="row">
<div class="col-lg-5 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading"> Option 1 : Your own infrastructure</h2>
<p class="lead">We configure your own infrastructure for {{ hosting_long }}. Keep the comfort and safety of being at your home, while we set things up for you.</p>
</div>
<div class="col-lg-5 col-lg-offset-2 col-sm-6">
<img class="img-responsive" src="{% static 'hosting/img/home.png' %}" alt="">
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.option 2 -->
<!-- /.content-section-a -->
<!-- / pricing -->
<a name="our"></a>
<div class="content-section-b"> <div class="content-section-b">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-5 col-lg-offset-1 col-sm-push-6 col-sm-6"> <div class="col-lg-5 col-lg-offset-1 col-sm-push-6 col-sm-6">
<hr class="section-heading-spacer"> <hr class="section-heading-spacer">
<div class="clearfix"></div> <div class="clearfix"></div>
<h2 class="section-heading">Option 2 : Our infrastructure</h2> <h2 class="section-heading">How it works : </h2>
<p class="lead">We take care of everything for you! You don't need your infrastructure. We give you everything you need in {{ hosting_long }} hosting. Full root access, 24x7 support.</p> <ul class="fa-ul">
{% block specification %}
{% endblock %}
</ul>
</div> </div>
{% with 'hosting/img/card-'|add:hosting|add:'.png' as image_static %}
<div class="col-lg-5 col-sm-pull-6 col-sm-6"> <div class="col-lg-5 col-sm-pull-6 col-sm-6">
<img class="img-responsive" src="{% static 'hosting/img/dog.png' %}" alt=""> <img class="img-responsive" src="{% static image_static %}" alt="">
</div> </div>
{% endwith %}
</div> </div>
</div><!-- /.container -->
</div><!-- /.option 1 -->
</div> <!-- Your Infrastructure -->
<!-- /.container --> {% include "hosting/includes/_your_infrastructure.html" %}
</div> <!-- Our Infrastructure -->
{% include "hosting/includes/_our_infrastructure.html" %}
<!-- /.content-section-b -->
<a name="price"></a>
<div class="content-section-a">
<div class="container"> <!-- Pricing -->
{% include "hosting/includes/_pricing.html" %}
<div class="row"> <!-- Contact -->
<div class="col-lg-5 col-sm-6"> {% include "hosting/includes/_contact.html" %}
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">Hosting Price Samples</h2>
<p class="lead">Here are samples of our {{ hosting_long }} hosting offers, suited for different projects. Our offer examples come in different size, speed, and storage. </p>
</div>
<!-- Title -->
<div class="row">
<div class="col-lg-12"></div>
</div>
<!-- /.row -->
<!-- Page Features -->
<div class="row text-center">
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="relsonsive" src="{% static 'hosting/img/economy.jpg' %}" alt="">
<div class="caption">
<h3>Economy </h3>
<p>Suited for smaller applications </p>
<p>1 core, </p>
<p>1 GiB RAM, </p>
<p>10 GiB system image (25 CHF)</p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a> </p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="relsonsive" src="{% static 'hosting/img/standardroom.jpg' %}" alt="">
<div class="caption">
<h3>Standard</h3>
<p>Suited for standard {{ hosting_long }} applications</p>
<p>1 core, </p>
<p>2 GiB RAM,</p>
<p> 10 GiB system image (30 CHF)</p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a>
</p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="reponsive" src="{% static 'hosting/img/deluxeroom.jpg' %}" alt="">
<div class="caption">
<h3>Deluxe</h3>
<p>Suited for performance critical project</p>
<p>2 cores,</p>
<p> 4 GiB Ram, </p>
<p>10 GiB system image (50 CHF) </p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a> </p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 hero-feature">
<div class="thumbnail">
<img class="responsive" src="{% static 'hosting/img/presidentialroom.jpg' %}" alt="">
<div class="caption">
<h3>Presidential Premium</h3>
<p> Suited for performance critical &amp; </p>
<p>high storage demand projects</p>
<p>4 Cores, 8 GiB RAM, 10 GiB System image, </p>
<p>100 GiB Data image (190 CHF)</p>
<p>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a>
</p>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div>
</div>
<!-- /.container -->
</div>
<!-- Configure -->
<a name="about"></a>
<div class="intro-header-1">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-message">
<h1>Let me try!</h1>
<p>&nbsp;</p>
<p>&nbsp;</p>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
{{ form.non_field_errors }}
{{ form.email.errors }}
<form action="{% url 'hosting:railshosting' %}" method="post" role="form" class="form-inline">
{% csrf_token %}
<div class="form-group">
<label class="sr-only" for="email">Email address</label>
<input type="email" name="email" class="form-control" id="id_email" placeholder="Enter email">
</div>
<button type="submit" class="btn btn-default">Request Beta Access</button>
</form>
</ul>
</div>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.content-section-a -->
<!-- / contact section -->
<a name="contact"></a>
<div class="banner">
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>QUESTIONS? </h2>
<h2>CONTACT US! </h2>
<h3>ungleich GmbH </h3>
<p><i class="fa fa-envelope-o"></i> {{ email }}</p>
<p>14 Hauptstrasse Luchsingen 8775</p>
<p>Switzerland</p>
<button type="button" class="btn btn-default">
<a href="https://twitter.com/ungleich">
<i class="fa fa-twitter fa-fw"></i><span class="network-name">Twitter</span></a>
</button>
<button type="button" class="btn btn-default">
<a href="https://github.com/ungleich"><i class="fa fa-github fa-fw"></i><span class="network-name">Github</span></a></button>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.banner -->
<!-- Footer --> <!-- Footer -->
<footer> {% include "hosting/includes/_footer.html" %}
<div class="container">
<div class="row"> <!-- Pricing data -->
<div class="col-lg-12"> {% if vm_types %}
<ul class="list-inline"> <script type="text/javascript">
<li> (function () {window.VMTypesData = "{{vm_types|safe}}";})();
<a href="#">Home</a> </script>
</li> {%endif%}
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">How it works</a></li> <!-- Lodash -->
<li class="footer-menu-divider">&sdot;</li> <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.11.1/lodash.min.js"></script>
<li>
<a href="#about">Your infrastructure</a></li>
<li>&sdot;</li>
<li>
<a href="#about">Our infrastructure</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#services">Pricing</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p>
</div>
</div>
</div>
</footer>
<!-- jQuery --> <!-- jQuery -->
<script src="{% static 'hosting/js/jquery.js' %}"></script> <script src="{% static 'hosting/js/jquery.js' %}"></script>
<!-- Pricing -->
<script src="{% static 'hosting/js/pricing.js' %}"></script>
<!-- Bootstrap Core JavaScript --> <!-- Bootstrap Core JavaScript -->
<script src="{% static 'hosting/js/bootstrap.min.js' %}"></script> <script src="{% static 'hosting/js/bootstrap.min.js' %}"></script>

View file

@ -0,0 +1,28 @@
<a name="contact"></a>
<div class="banner">
<div class="container">
<div class="row">
<div class="col-lg-6">
<h2>QUESTIONS? </h2>
<h2>CONTACT US! </h2>
<h3>ungleich GmbH </h3>
<p><i class="fa fa-envelope-o"></i> {{ email }}</p>
<p>14 Hauptstrasse Luchsingen 8775</p>
<p>Switzerland</p>
<button type="button" class="btn btn-default">
<a href="https://twitter.com/ungleich">
<i class="fa fa-twitter fa-fw"></i><span class="network-name">Twitter</span></a>
</button>
<button type="button" class="btn btn-default">
<a href="https://github.com/ungleich"><i class="fa fa-github fa-fw"></i><span class="network-name">Github</span></a></button>
</div>
</div>
</div>
<!-- /.container -->
</div>

View file

@ -0,0 +1,33 @@
{% load staticfiles %}
<footer>
<div class="container">
<div class="row">
<div class="col-lg-12">
<ul class="list-inline">
<li>
<a href="#">Home</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">How it works</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#about">Your infrastructure</a></li>
<li>&sdot;</li>
<li>
<a href="#about">Our infrastructure</a></li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#services">Pricing</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p>
</div>
</div>
</div>
</footer>

View file

@ -0,0 +1,31 @@
{% load staticfiles %}
<a name="about"></a>
<div class="intro-header">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-message">
<img class="responsive" src="{% static 'hosting/img/Beta.png' %}">
<h1>{{ domain }}</h1>
<h3>{{ hosting_long }} as easy as possible</h3>
<hr class="intro-divider">
<ul class="list-inline intro-social-buttons">
<li>
<a href="#howitworks" class="btn btn-default btn-lg"><i class="#Services"></i> <span class="network-name">how it works</span></a>
</li>
<li>
<a href="#own" class="btn btn-default btn-lg page-scroll"><span class="network-name">Let me start</span></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- /.container -->
</div>
<!-- /.intro-header -->

View file

@ -0,0 +1,39 @@
{% load staticfiles %}
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand topnav" href="#"><img src="{% static 'hosting/img/logo_black.svg' %}"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#how">How it works</a>
</li>
<li>
<a href="#your">Your infrastructure</a>
</li>
<li>
<a href="#our">Our inftrastructure</a>
</li>
<li>
<a href="#price">Pricing</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>

View file

@ -0,0 +1,23 @@
{% load staticfiles %}
<a name="our"></a>
<div class="content-section-b">
<div class="container">
<div class="row">
<div class="col-lg-5 col-lg-offset-1 col-sm-push-6 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">Option 2 : Our infrastructure</h2>
<p class="lead">We take care of everything for you! You don't need your infrastructure. We give you everything you need in {{ hosting_long }} hosting. Full root access, 24x7 support.</p>
</div>
<div class="col-lg-5 col-sm-pull-6 col-sm-6">
<img class="img-responsive" src="{% static 'hosting/img/dog.png' %}" alt="">
</div>
</div>
</div>
<!-- /.container -->
</div>

View file

@ -0,0 +1,144 @@
<a name="price"></a>
<div class="content-section-a">
<div class="container">
<div class="row">
<div class="col-lg-5 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading">Hosting Price Samples</h2>
<p class="lead">Here are samples of our {{ hosting_long }} hosting offers, suited for different projects. Our offer examples come in different size, speed, and storage. </p>
</div>
<!-- Title -->
<div class="row">
<div class="col-lg-12"></div>
</div>
<!-- Page Features -->
<div class="row text-center">
<div class="block">
{% for vm in vm_types %}
<div class="row well pricing">
<form class="form-inline p-green" role="form">
<div class="btn-group col-md-3">
<div class="form-group">
<big>
{{vm.hosting_company_name}}
</big>
<p>
{{vm.description}}
</p>
</div>
</div>
<div class="btn-group col-md-2">
<div class="form-group">
<label for="cores">Cores:</label>
<select class="form-control" id="cores">
{% with ''|center:10 as range %}
{% for _ in range %}
<option>{{ forloop.counter }}</option>
{% endfor %}
{% endwith %}
</select>
</div>
</div>
<div class="btn-group col-md-2">
<label for="memory">Memory: </label>
<div class="form-group">
<select class="form-control short-input" id="memory">
{% with ''|center:50 as range %}
{% for _ in range %}
<option>{{ forloop.counter }}</option>
{% endfor %}
{% endwith %}
</select>
<span>GiB</span>
</div>
</div>
<div class="form-group col-md-2">
<label for="Disk Size">Disk Size: </label>
<input class="form-control short-input" type="number" id="disk_space" min="0" value="0"/>
<span>GiB</span>
</div>
<div class="col-md-2">
<h3>$199</h3>
</div>
<div class="col-md-1">
<button type="submit" class="btn btn-default">Buy it</button>
</div>
<!-- <button type="submit" class="btn btn-default">Submit</button> -->
</form>
</div>
{% endfor %}
{% for vm in vm_types %}
<div class="col-xs-12 col-sm-6 col-md-3">
<form class="form-inline">
<ul class="pricing {% cycle 'p-green' 'p-yel' 'p-red' 'p-blue' %}">
<li style="height:200px;">
<!-- <img src="http://bread.pp.ua/n/settings_g.svg" alt=""> -->
<h3 >{{vm.hosting_company_name}}</h3>
</li>
<li>
<!-- Single button -->
<div class="btn-group">
<div class="form-group">
<label for="cores">Cores: </label>
<select class="form-control cores-selector" id="{{vm.hosting_company}}-cores" data-vm-type="{{vm.hosting_company}}">
{% with ''|center:10 as range %}
{% for _ in range %}
<option>{{ forloop.counter }}</option>
{% endfor %}
{% endwith %}
</select>
</div>
</div>
</li>
<li class="row">
<div class="btn-group">
<div class="form-group">
<label for="memory">Memory: </label>
<select class="form-control memory-selector" id="{{vm.hosting_company}}-memory" data-vm-type="{{vm.hosting_company}}">
{% with ''|center:50 as range %}
{% for _ in range %}
<option>{{ forloop.counter }}</option>
{% endfor %}
{% endwith %}
</select>
<span>GiB</span>
</div>
</div>
</li>
<li class="row">
<div class="form-group">
<label for="Disk Size">Disk Size: </label>
<input class="form-control short-input disk-space-selector" type="number" id="{{vm.hosting_company}}-disk_space" min="10" value="10" data-vm-type="{{vm.hosting_company}}"/>
<span>GiB</span>
</div>
</li>
<li>
<h3 id="{{vm.hosting_company}}-final-price">{{vm.default_price|floatformat}}$</h3>
<span>per month</span>
</li>
<li>
<button>Buy it</button>
</li>
</ul>
</form>
</div>
{% endfor %}
</div><!-- /block -->
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,20 @@
{% load staticfiles %}
<a name="your"></a>
<div class="content-section-a" id="own">
<div class="container">
<div class="row">
<div class="col-lg-5 col-sm-6">
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<h2 class="section-heading"> Option 1 : Your own infrastructure</h2>
<p class="lead">We configure your own infrastructure for {{ hosting_long }}. Keep the comfort and safety of being at your home, while we set things up for you.</p>
</div>
<div class="col-lg-5 col-lg-offset-2 col-sm-6">
<img class="img-responsive" src="{% static 'hosting/img/home.png' %}" alt="">
</div>
</div>
</div>
<!-- /.container -->
</div>

View file

@ -14,16 +14,16 @@
<title>Rails Hosting.ch - Ruby on Rails as easy as possible</title> <title>Rails Hosting.ch - Ruby on Rails as easy as possible</title>
<!-- Bootstrap Core CSS --> <!-- Bootstrap Core CSS -->
<link href="{% static 'railshosting/css/bootstrap.min.css' %}" rel="stylesheet"> <link href="{% static 'hosting/css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom CSS --> <!-- Custom CSS -->
<link href="{% static 'railshosting/css/landing-page.css' %}" rel="stylesheet"> <link href="{% static 'hosting/css/landing-page.css' %}" rel="stylesheet">
<!-- Custom Fonts --> <!-- Custom Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link href="{% static 'railshosting/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css"> <link href="{% static 'hosting/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css"> <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="{% static 'railshosting/img/favicon.ico' %}" type="image/x-icon" /> <link rel="shortcut icon" href="{% static 'hosting/img/favicon.ico' %}" type="image/x-icon" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
@ -296,7 +296,7 @@
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
{{ form.email.errors }} {{ form.email.errors }}
<form action="{% url 'railshosting:index' %}" method="post" role="form" class="form-inline"> <form action="" method="post" role="form" class="form-inline">
{% csrf_token %} {% csrf_token %}
<div class="form-group"> <div class="form-group">
<label class="sr-only" for="email">Email address</label> <label class="sr-only" for="email">Email address</label>

View file

@ -1,3 +1,4 @@
{% load staticfiles bootstrap3%}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -12,10 +13,10 @@
<title>Rails Hosting.ch - Ruby on Rails as easy as possible</title> <title>Rails Hosting.ch - Ruby on Rails as easy as possible</title>
<!-- Bootstrap Core CSS --> <!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="{% static 'hosting/css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom CSS --> <!-- Custom CSS -->
<link href="css/landing-page.css" rel="stylesheet"> <link href="{% static 'hosting/css/landing-page.css' %}" rel="stylesheet">
<!-- Custom Fonts --> <!-- Custom Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
@ -77,34 +78,26 @@
<a name="about"></a> <a name="about"></a>
<div class="intro-header"> <div class="intro-header">
<div class="container"> <div class="container">
<div class="col-md-4">&nbsp;</div><div class="col-md-4"> <div class="col-md-4">&nbsp;</div><div class="col-md-4">
<div class="intro-message">
<div class="intro-message"><img class="responsive" src="img/Beta.png"> <h2>Login</h2>
<h3>Log In</h3> <form action="{% url 'hosting:login' %}" method="post" class="form" novalidate>
<form> {% csrf_token %}
<div class="form-group"> {% for field in form %}
<label for="exampleInputEmail1">Email address</label> {% bootstrap_field field show_label=False type='fields'%}
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email"> {% endfor %}
</div> {% bootstrap_form_errors form type='non_fields'%}
<div class="form-group"> {% buttons %}
<label for="exampleInputPassword1">Password</label> <button type="submit" class="btn btn-default">
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password"> Login
</div> </button>
<div class> {% endbuttons %}
<p><a href="#" id="forgotpassword"> </form>
Forgot password?</a> <ul class="list-inline intro-social-buttons">
</p>
<p>&nbsp;</p> </ul>
</div> </div>
<button type="submit" class="btn btn-default">Log In</button>
</form></p>
<ul class="list-inline intro-social-buttons">
</ul></div>&nbsp;<div class="col-md-4"></div>
</div>
</div>
</div> </div>
</div> </div>
<!-- /.container --> <!-- /.container -->
@ -138,7 +131,7 @@
<a href="#contact">Contact</a> <a href="#contact">Contact</a>
</li> </li>
</ul> </ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH 2015. All Rights Reserved</p> <p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,3 +1,5 @@
{% load staticfiles bootstrap3%}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -9,13 +11,13 @@
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<title>Rails Hosting.ch - Ruby on Rails as easy as possible</title> <title>Signup</title>
<!-- Bootstrap Core CSS --> <!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="{% static 'hosting/css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom CSS --> <!-- Custom CSS -->
<link href="css/landing-page.css" rel="stylesheet"> <link href="{% static 'hosting/css/landing-page.css' %}" rel="stylesheet">
<!-- Custom Fonts --> <!-- Custom Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
@ -45,7 +47,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand topnav" href="#"><img src="img/logo_black.svg"></a> <a class="navbar-brand topnav" href="#"><img src="{% static 'hosting/img/logo_black.svg' %}"></a>
</div> </div>
<!-- Collect the nav links, forms, and other content for toggling --> <!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
@ -77,36 +79,27 @@
<a name="about"></a> <a name="about"></a>
<div class="intro-header-2"> <div class="intro-header-2">
<div class="container"> <div class="container">
<div class="col-md-4">&nbsp;</div><div class="col-md-4"> <div class="col-md-4">&nbsp;</div><div class="col-md-4">
<div class="intro-"><img class="responsive" src="img/Beta.png"> <div class="intro-message">
<h2>Sign up</h2> <h2>Sign up</h2>
<form> <form action="{% url 'hosting:signup' %}" method="post" class="form" novalidate>
<div class="form-group"> {% csrf_token %}
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter your name or comapny name"> {% for field in form %}
</div> {% bootstrap_field field show_label=False %}
<div class="form-group"> {% endfor %}
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email"> {% buttons %}
</div> <button type="submit" class="btn btn-default">
<div class="form-group"> Signup
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password"> </button>
</div> {% endbuttons %}
<div class="form-group"> </form>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Confirm Password"> <ul class="list-inline intro-social-buttons">
</div><div class="col-md-4">&nbsp;</div>
<div class> </ul>
<p>&nbsp;</p> </div>
</div>
<button type="submit" class="btn btn-default">Sign Up</button>
</form></p></div>
<ul class="list-inline intro-social-buttons">
</ul>
</div>
</div>
</div> </div>
</div> </div>
</div>
<!-- /.container --> <!-- /.container -->
</div> </div>
@ -139,7 +132,7 @@
<a href="#contact">Contact</a> <a href="#contact">Contact</a>
</li> </li>
</ul> </ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH 2015. All Rights Reserved</p> <p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,10 +1,14 @@
from django.conf.urls import url from django.conf.urls import url
from . import views from .views import VMPricingView, DjangoHostingView, RailsHostingView, \
NodeJSHostingView, LoginView, SignupView, IndexView
urlpatterns = [ urlpatterns = [
url(r'beta$', views.beta, name='beta'), url(r'index/?$', IndexView.as_view(), name='index'),
url(r'django$', views.djangohosting, name='djangohosting'), url(r'pricing/?$', VMPricingView.as_view(), name='pricing'),
url(r'nodejs$', views.nodejshosting, name='nodejshosting'), url(r'django/?$', DjangoHostingView.as_view(), name='djangohosting'),
url(r'rails$', views.railshosting, name='railshosting'), url(r'nodejs/?$', NodeJSHostingView.as_view(), name='nodejshosting'),
url(r'rails/?$', RailsHostingView.as_view(), name='railshosting'),
url(r'login/?$', LoginView.as_view(), name='login'),
url(r'signup/?$', SignupView.as_view(), name='signup'),
] ]

View file

@ -1,76 +1,157 @@
import datetime
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
from django.forms import ModelForm from django.core.urlresolvers import reverse_lazy, reverse
from django.views.generic import View, CreateView, FormView
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse from django.contrib.auth import authenticate, login
from django.core.mail import send_mail from membership.models import CustomUser
from django.core.mail import mail_managers from .models import RailsBetaUser, VirtualMachineType
from .forms import HostingUserSignupForm, HostingUserLoginForm
from .models import RailsBetaUser
class RailsBetaUserForm(ModelForm): class VMPricingView(View):
required_css_class = 'form-control' template_name = "hosting/pricing.html"
class Meta:
model = RailsBetaUser
fields = [ 'email' ]
def hosting(request, context): def get(self, request, *args, **kwargs):
email = RailsBetaUser(received_date=datetime.datetime.now()) return render(request, self.template_name, request)
if request.method == 'POST':
context['form'] = RailsBetaUserForm(request.POST, instance=email)
if context['form'].is_valid():
context['form'].save()
email = context['form'].cleaned_data['email']
subject = "%shosting request" % context['hosting']
message = "Request for beta by: %s" % email
mail_managers(subject, message) class DjangoHostingView(View):
template_name = "hosting/django.html"
return HttpResponseRedirect(reverse("hosting:beta")) def get_context_data(self, **kwargs):
else: context = {}
context['form'] = RailsBetaUserForm() context["hosting"] = "django"
context['error_message'] = "a problem" context["hosting_long"] = "Django"
context["domain"] = "django-hosting.ch"
context["google_analytics"] = "UA-62285904-6"
context["email"] = "info@django-hosting.ch"
context["vm_types"] = VirtualMachineType.get_serialized_vm_types()
return context
page = "hosting/%s.html" % context['hosting'] def get(self, request, *args, **kwargs):
context = self.get_context_data()
return render(request, self.template_name, context)
return render(request, page, context)
################################################################################ class RailsHostingView(View):
# Hostings template_name = "hosting/rails.html"
#
def djangohosting(request):
context = {}
context["hosting"]="django"
context["hosting_long"]="Django"
context["domain"]="django-hosting.ch"
context["google_analytics"]="UA-62285904-6"
context["email"]="info@django-hosting.ch"
return hosting(request, context) def get_context_data(self, **kwargs):
context = {}
context["hosting"] = "rails"
context["hosting_long"] = "Ruby On Rails"
context["domain"] = "rails-hosting.ch"
context["google_analytics"] = "UA-62285904-5"
context["email"] = "info@rails-hosting.ch"
context["vm_types"] = VirtualMachineType.get_serialized_vm_types()
return context
def railshosting(request): def get(self, request, *args, **kwargs):
context = {} context = self.get_context_data()
context["hosting"]="rails" return render(request, self.template_name, context)
context["hosting_long"]="Ruby On Rails"
context["domain"]="rails-hosting.ch"
context["google_analytics"]="UA-62285904-5"
context["email"]="info@rails-hosting.ch"
return hosting(request, context)
def nodejshosting(request): class NodeJSHostingView(View):
context = {} template_name = "hosting/nodejs.html"
context["hosting"]="nodejs" def get_context_data(self, **kwargs):
context["hosting_long"]="NodeJS" context = {}
context["domain"]="node-hosting.ch" context["hosting"] = "nodejs"
context["google_analytics"]="UA-62285904-7" context["hosting_long"] = "NodeJS"
context["email"]="info@node-hosting.ch" context["domain"] = "node-hosting.ch"
context["google_analytics"] = "UA-62285904-7"
context["email"] = "info@node-hosting.ch"
context["vm_types"] = VirtualMachineType.get_serialized_vm_types()
return context
return hosting(request, context) def get(self, request, *args, **kwargs):
context = self.get_context_data()
return render(request, self.template_name, context)
def beta(request):
return render(request, 'hosting/beta.html') class IndexView(View):
template_name = "hosting/index.html"
def get_context_data(self, **kwargs):
context = {}
context["hosting"] = "nodejs"
context["hosting_long"] = "NodeJS"
context["domain"] = "node-hosting.ch"
context["google_analytics"] = "UA-62285904-7"
context["email"] = "info@node-hosting.ch"
context["vm_types"] = VirtualMachineType.get_serialized_vm_types()
return context
def get(self, request, *args, **kwargs):
context = self.get_context_data()
return render(request, self.template_name, context)
class LoginView(FormView):
template_name = 'hosting/login.html'
form_class = HostingUserLoginForm
moodel = CustomUser
success_url = reverse_lazy('hosting:login')
def form_valid(self, form):
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
auth_user = authenticate(email=email, password=password)
if auth_user:
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
return HttpResponseRedirect(self.get_success_url())
class SignupView(CreateView):
template_name = 'hosting/signup.html'
form_class = HostingUserSignupForm
moodel = CustomUser
def get_success_url(self):
return reverse_lazy('hosting:signup')
def form_valid(self, form):
name = form.cleaned_data.get('name')
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
CustomUser.register(name, password, email)
auth_user = authenticate(email=email, password=password)
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
# class RailsBetaUserForm(ModelForm):
# required_css_class = 'form-control'
# class Meta:
# model = RailsBetaUser
# fields = [ 'email' ]
# def hosting(request, context):
# email = RailsBetaUser(received_date=datetime.datetime.now())
# if request.method == 'POST':
# context['form'] = RailsBetaUserForm(request.POST, instance=email)
# if context['form'].is_valid():
# context['form'].save()
# email = context['form'].cleaned_data['email']
# subject = "%shosting request" % context['hosting']
# message = "Request for beta by: %s" % email
# mail_managers(subject, message)
# return HttpResponseRedirect(reverse("hosting:beta"))
# else:
# context['form'] = RailsBetaUserForm()
# context['error_message'] = "a problem"
# page = "hosting/%s.html" % context['hosting']
# return render(request, page, context)
# def beta(request):
# return render(request, 'hosting/beta.html')