Merge pull request #73 from levivm/develop

Changed offers in VM pricing, Fixed pricing error changing disk size,…
This commit is contained in:
Levi Velázquez 2016-05-19 01:51:25 -04:30
commit b4fef1e296
13 changed files with 124 additions and 44 deletions

View file

@ -443,6 +443,12 @@ PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'},)}
AUTH_USER_MODEL = 'membership.CustomUser' AUTH_USER_MODEL = 'membership.CustomUser'
ALLOWED_HOSTS = [
"*"
]
# PAYMENT # PAYMENT
STRIPE_DESCRIPTION_ON_PAYMENT = "Payment for ungleich GmbH services" STRIPE_DESCRIPTION_ON_PAYMENT = "Payment for ungleich GmbH services"
@ -455,7 +461,7 @@ REGISTRATION_MESSAGE = {'subject': "Validation mail",
STRIPE_API_PRIVATE_KEY = env('STRIPE_API_PRIVATE_KEY') STRIPE_API_PRIVATE_KEY = env('STRIPE_API_PRIVATE_KEY')
STRIPE_API_PUBLIC_KEY = env('STRIPE_API_PUBLIC_KEY') STRIPE_API_PUBLIC_KEY = env('STRIPE_API_PUBLIC_KEY')
DEBUG = False DEBUG = True
if DEBUG: if DEBUG:
from .local import * from .local import *

View file

@ -12,39 +12,41 @@ class Command(BaseCommand):
'core_price': 10, 'core_price': 10,
'memory_price': 5, 'memory_price': 5,
'disk_size_price': 1, 'disk_size_price': 1,
'description': 'VM auf einzelner HW, Raid1, kein HA' 'description': 'VM auf einzelner HW, Raid1, kein HA',
'location':'DE'
} }
return { return {
'hetzner_nug': { # 'hetzner_nug': {
'base_price': 5, # 'base_price': 5,
'memory_price': 2, # 'memory_price': 2,
'core_price': 2, # 'core_price': 2,
'disk_size_price': 0.5, # 'disk_size_price': 0.5,
'description': 'VM ohne Uptime Garantie' # 'description': 'VM ohne Uptime Garantie'
}, # },
'hetzner': hetzner, 'hetzner': hetzner,
'hetzner_raid6': { # 'hetzner_raid6': {
'base_price': hetzner['base_price']*1.2, # 'base_price': hetzner['base_price']*1.2,
'core_price': hetzner['core_price']*1.2, # 'core_price': hetzner['core_price']*1.2,
'memory_price': hetzner['memory_price']*1.2, # 'memory_price': hetzner['memory_price']*1.2,
'disk_size_price': hetzner['disk_size_price']*1.2, # 'disk_size_price': hetzner['disk_size_price']*1.2,
'description': 'VM auf einzelner HW, Raid1, kein HA' # 'description': 'VM auf einzelner HW, Raid1, kein HA'
}, # },
'hetzner_glusterfs': { # 'hetzner_glusterfs': {
'base_price': hetzner['base_price']*1.4, # 'base_price': hetzner['base_price']*1.4,
'core_price': hetzner['core_price']*1.4, # 'core_price': hetzner['core_price']*1.4,
'memory_price': hetzner['memory_price']*1.4, # 'memory_price': hetzner['memory_price']*1.4,
'disk_size_price': hetzner['disk_size_price']*1.4, # 'disk_size_price': hetzner['disk_size_price']*1.4,
'description': 'VM auf einzelner HW, Raid1, kein HA' # 'description': 'VM auf einzelner HW, Raid1, kein HA'
}, # },
'bern': { 'bern': {
'base_price': 12, 'base_price': 12,
'core_price': 25, 'core_price': 25,
'memory_price': 7, 'memory_price': 7,
'disk_size_price': 0.70, 'disk_size_price': 0.70,
'description': "VM in Bern, HA Setup ohne HA Garantie", 'description': "VM in Bern, HA Setup ohne HA Garantie",
'location':'CH',
} }
} }

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-19 04:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hosting', '0016_delete_railsbetauser'),
]
operations = [
migrations.AddField(
model_name='virtualmachinetype',
name='location',
field=models.CharField(choices=[('DE', 'Germany'), ('CH', 'Switzerland')], default='DE', max_length=3),
preserve_default=False,
),
]

View file

@ -17,6 +17,8 @@ class VirtualMachineType(models.Model):
HETZNER_R6 = 'hetzner_raid6' HETZNER_R6 = 'hetzner_raid6'
HETZNER_G = 'hetzner_glusterfs' HETZNER_G = 'hetzner_glusterfs'
BERN = 'bern' BERN = 'bern'
DE_LOCATION = 'DE'
CH_LOCATION = 'CH'
HOSTING_TYPES = ( HOSTING_TYPES = (
(HETZNER_NUG, 'Hetzner No Uptime Guarantee'), (HETZNER_NUG, 'Hetzner No Uptime Guarantee'),
@ -26,12 +28,17 @@ class VirtualMachineType(models.Model):
(BERN, 'Bern'), (BERN, 'Bern'),
) )
LOCATIONS_CHOICES = (
(DE_LOCATION, 'Germany'),
(CH_LOCATION, 'Switzerland'),
)
description = models.TextField() description = models.TextField()
base_price = models.FloatField() base_price = models.FloatField()
memory_price = models.FloatField() memory_price = models.FloatField()
core_price = models.FloatField() core_price = models.FloatField()
disk_size_price = models.FloatField() disk_size_price = models.FloatField()
hosting_company = models.CharField(max_length=30, choices=HOSTING_TYPES) hosting_company = models.CharField(max_length=30, choices=HOSTING_TYPES)
location = models.CharField(max_length=3, choices=LOCATIONS_CHOICES)
def __str__(self): def __str__(self):
return "%s" % (self.get_hosting_company_display()) return "%s" % (self.get_hosting_company_display())
@ -65,6 +72,8 @@ class VirtualMachineType(models.Model):
'hosting_company_name': self.get_hosting_company_display(), 'hosting_company_name': self.get_hosting_company_display(),
'hosting_company': self.hosting_company, 'hosting_company': self.hosting_company,
'default_price': self.defeault_price(), 'default_price': self.defeault_price(),
'location_code': self.location,
'location': self.get_location_display(),
'id': self.id, 'id': self.id,
} }

View file

@ -33,7 +33,7 @@
.pricing li.type { .pricing li.type {
list-style: none; list-style: none;
padding: 13px; padding: 13px;
height: 200px; height: 150px;
} }
.pricing big { .pricing big {
@ -72,6 +72,16 @@
box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1);
} }
/* pricing color */ /* pricing color */
.p-black big,
.p-black h3 {
color: black;
}
.p-black button {
background: black;
}
.p-green big, .p-green big,
.p-green h3 { .p-green h3 {
color: #4c7737; color: #4c7737;

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

View file

@ -49,5 +49,9 @@ $( document ).ready(function() {
$('.disk-space-selector').on('change',change_attribute); $('.disk-space-selector').on('change',change_attribute);
//Disable input
$('.disk-space-selector').keypress(function(event){
event.preventDefault();
});
}); });

View file

@ -81,23 +81,23 @@
</li> </li>
{% else %} {% else %}
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#how">How it works</a> <a href="{{ request.session.hosting_url}}#how">How it works</a>
</li> </li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#your">Your infrastructure</a> <a href="{{ request.session.hosting_url }}#your">Your infrastructure</a>
</li> </li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#our">Our inftrastructure</a> <a href="{{ request.session.hosting_url }}#our">Our inftrastructure</a>
</li> </li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#price">Pricing</a> <a href="{{ request.session.hosting_url }}#price">Pricing</a>
</li> </li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#contact">Contact</a> <a href="{{ request.session.hosting_url }}#contact">Contact</a>
</li> </li>
<li> <li>
<a href="{% url 'hosting:login' %}?next={{request.current_path}}">Login</a> <a href="{% url 'hosting:login' %}?next={{request.current_path}}">Login</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
@ -123,21 +123,22 @@
</li> </li>
<li class="footer-menu-divider">&sdot;</li> <li class="footer-menu-divider">&sdot;</li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#how">How it works</a> <a href="{{ request.session.hosting_url}}#how">How it works</a>
<li class="footer-menu-divider">&sdot;</li> <li class="footer-menu-divider">&sdot;</li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#your">Your infrastructure</a></li> <a href="{{ request.session.hosting_url }}#your">Your infrastructure</a></li>
<li>&sdot;</li> <li>&sdot;</li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#our">Our infrastructure</a></li> <a href="{{ request.session.hosting_url }}#our">Our infrastructure</a></li>
<li class="footer-menu-divider">&sdot;</li> <li class="footer-menu-divider">&sdot;</li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#services">Pricing</a> <a href="{{ request.session.hosting_url }}#services">Pricing</a>
</li> </li>
<li class="footer-menu-divider">&sdot;</li> <li class="footer-menu-divider">&sdot;</li>
<li> <li>
<a href="{{ request.META.HTTP_REFERER }}#contact">Contact</a> <a href="{{ request.session.hosting_url }}#contact">Contact</a>
</li> </li>
</ul> </ul>
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p> <p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. All Rights Reserved</p>
</div> </div>

View file

@ -1,3 +1,4 @@
{% load staticfiles %}
<a name="price"></a> <a name="price"></a>
<div class="content-section-b"> <div class="content-section-b">
<div class="container-fluid pricing-container"> <div class="container-fluid pricing-container">
@ -6,7 +7,6 @@
<hr class="section-heading-spacer"> <hr class="section-heading-spacer">
<div class="clearfix"></div> <div class="clearfix"></div>
<h2 class="section-heading">Hosting Price</h2> <h2 class="section-heading">Hosting Price</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> </div>
<!-- Title --> <!-- Title -->
<div class="row"> <div class="row">
@ -17,17 +17,31 @@
<!-- Page Features --> <!-- Page Features -->
<div class="row text-center"> <div class="row text-center">
<div class="block col-md-offset-1"> <div class="block col-md-offset-3">
{% for vm in vm_types %} {% for vm in vm_types %}
<div class="col-xs-12 col-sm-6 col-md-2"> <div class="col-xs-12 col-sm-6 col-md-4">
<form class="form-inline" method="POST" action="{{request.path}}"> <form class="form-inline" method="POST" action="{{request.path}}">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="hosting_company" value="{{vm.hosting_company}}"> <input type="hidden" name="hosting_company" value="{{vm.hosting_company}}">
<input type="hidden" name="hosting_company_name" value="{{vm.hosting_company_name}}"> <input type="hidden" name="hosting_company_name" value="{{vm.hosting_company_name}}">
<ul class="pricing {% cycle 'p-green' 'p-yel' 'p-red' 'p-blue' %}">
<ul class="pricing {% cycle 'p-red' 'p-black' 'p-red' 'p-yel' %}">
<li class="type"> <li class="type">
<!-- <img src="http://bread.pp.ua/n/settings_g.svg" alt=""> --> <!-- <img src="http://bread.pp.ua/n/settings_g.svg" alt=""> -->
<h3 >{{vm.hosting_company_name}}</h3> <h3 >{{vm.hosting_company_name}}</h3>
<br/>
<img class="img-responsive" src="{{ STATIC_URL }}hosting/img/{{vm.location_code}}_flag.png" alt="">
</li>
<li>
<!-- Single button -->
<div class="btn-group">
<div class="form-group">
<label for="cores">Location: </label>
{{vm.location}}
</div>
</div>
</li> </li>
<li> <li>
<!-- Single button --> <!-- Single button -->
@ -64,7 +78,7 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-xs-offset-1 col-xs-9 col-sm-12 col-md-12 col-md-offset-0"> <div class="col-xs-offset-1 col-xs-9 col-sm-12 col-md-12 col-md-offset-0">
<label for="Disk Size">Disk Size: </label> <label for="Disk Size">Disk Size: </label>
<input class="form-control short-input text-center disk-space-selector" name="disk_space" type="number" id="{{vm.hosting_company}}-disk_space" min="10" value="10" data-vm-type="{{vm.hosting_company}}"/> <input class="form-control short-input text-center disk-space-selector" name="disk_space" type="number" id="{{vm.hosting_company}}-disk_space" min="10" value="10" step="10" data-vm-type="{{vm.hosting_company}}"/>
<span>GiB</span> <span>GiB</span>
</div> </div>
</div> </div>
@ -75,7 +89,7 @@
<span>per month</span> <span>per month</span>
</li> </li>
<li> <li>
<button>Buy it</button> <button>Book it</button>
</li> </li>
</ul> </ul>
</form> </form>

View file

@ -5,6 +5,17 @@
<div class="intro-auth intro-login"> <div class="intro-auth intro-login">
<div class="container"> <div class="container">
<div class="col-md-4 col-md-offset-4"> <div class="col-md-4 col-md-offset-4">
{% block messages %}
{% if request.GET.logged_out %}
<div class="alert alert-warning"> <!-- singular -->
<a class="close" data-dismiss="alert">×</a>
You haven been logged out
</div>
{% endif %}
{% endblock %}
<div class="intro-message"> <div class="intro-message">
<h2 class="section-heading">Login</h2> <h2 class="section-heading">Login</h2>
<form action="{% url 'hosting:login' %}" method="post" class="form" novalidate> <form action="{% url 'hosting:login' %}" method="post" class="form" novalidate>

View file

@ -20,5 +20,5 @@ urlpatterns = [
url(r'login/?$', LoginView.as_view(), name='login'), url(r'login/?$', LoginView.as_view(), name='login'),
url(r'signup/?$', SignupView.as_view(), name='signup'), url(r'signup/?$', SignupView.as_view(), name='signup'),
url(r'^logout/?$', 'django.contrib.auth.views.logout', url(r'^logout/?$', 'django.contrib.auth.views.logout',
{'next_page': '/ungleich_page'}, name='logout') {'next_page': '/hosting/login?logged_out=true'}, name='logout')
] ]

View file

@ -29,10 +29,11 @@ class DjangoHostingView(ProcessVMSelectionMixin, View):
'email': "info@django-hosting.ch", 'email': "info@django-hosting.ch",
'vm_types': VirtualMachineType.get_serialized_vm_types(), 'vm_types': VirtualMachineType.get_serialized_vm_types(),
} }
return context return context
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
request.session['hosting_url'] = reverse('hosting:djangohosting')
context = self.get_context_data() context = self.get_context_data()
return render(request, self.template_name, context) return render(request, self.template_name, context)
@ -53,6 +54,7 @@ class RailsHostingView(ProcessVMSelectionMixin, View):
return context return context
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
request.session['hosting_url'] = reverse('hosting:railshosting')
context = self.get_context_data() context = self.get_context_data()
return render(request, self.template_name, context) return render(request, self.template_name, context)
@ -72,7 +74,7 @@ class NodeJSHostingView(ProcessVMSelectionMixin, View):
return context return context
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
request.session['hosting_url'] = reverse('hosting:nodejshosting')
context = self.get_context_data() context = self.get_context_data()
return render(request, self.template_name, context) return render(request, self.template_name, context)