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 f1b1faa631
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'
ALLOWED_HOSTS = [
"*"
]
# PAYMENT
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_PUBLIC_KEY = env('STRIPE_API_PUBLIC_KEY')
DEBUG = False
DEBUG = True
if DEBUG:
from .local import *

View file

@ -12,39 +12,41 @@ class Command(BaseCommand):
'core_price': 10,
'memory_price': 5,
'disk_size_price': 1,
'description': 'VM auf einzelner HW, Raid1, kein HA'
'description': 'VM auf einzelner HW, Raid1, kein HA',
'location':'DE'
}
return {
'hetzner_nug': {
'base_price': 5,
'memory_price': 2,
'core_price': 2,
'disk_size_price': 0.5,
'description': 'VM ohne Uptime Garantie'
},
# '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_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'
},
# },
# '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",
'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_G = 'hetzner_glusterfs'
BERN = 'bern'
DE_LOCATION = 'DE'
CH_LOCATION = 'CH'
HOSTING_TYPES = (
(HETZNER_NUG, 'Hetzner No Uptime Guarantee'),
@ -26,12 +28,17 @@ class VirtualMachineType(models.Model):
(BERN, 'Bern'),
)
LOCATIONS_CHOICES = (
(DE_LOCATION, 'Germany'),
(CH_LOCATION, 'Switzerland'),
)
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)
location = models.CharField(max_length=3, choices=LOCATIONS_CHOICES)
def __str__(self):
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': self.hosting_company,
'default_price': self.defeault_price(),
'location_code': self.location,
'location': self.get_location_display(),
'id': self.id,
}

View file

@ -33,7 +33,7 @@
.pricing li.type {
list-style: none;
padding: 13px;
height: 200px;
height: 150px;
}
.pricing big {
@ -72,6 +72,16 @@
box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.1);
}
/* pricing color */
.p-black big,
.p-black h3 {
color: black;
}
.p-black button {
background: black;
}
.p-green big,
.p-green h3 {
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);
//Disable input
$('.disk-space-selector').keypress(function(event){
event.preventDefault();
});
});

View file

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

View file

@ -1,3 +1,4 @@
{% load staticfiles %}
<a name="price"></a>
<div class="content-section-b">
<div class="container-fluid pricing-container">
@ -6,7 +7,6 @@
<hr class="section-heading-spacer">
<div class="clearfix"></div>
<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>
<!-- Title -->
<div class="row">
@ -17,17 +17,31 @@
<!-- Page Features -->
<div class="row text-center">
<div class="block col-md-offset-1">
<div class="block col-md-offset-3">
{% 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}}">
{% csrf_token %}
<input type="hidden" name="hosting_company" value="{{vm.hosting_company}}">
<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">
<!-- <img src="http://bread.pp.ua/n/settings_g.svg" alt=""> -->
<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>
<!-- Single button -->
@ -64,7 +78,7 @@
<div class="form-group row">
<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>
<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>
</div>
</div>
@ -75,7 +89,7 @@
<span>per month</span>
</li>
<li>
<button>Buy it</button>
<button>Book it</button>
</li>
</ul>
</form>

View file

@ -5,6 +5,17 @@
<div class="intro-auth intro-login">
<div class="container">
<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">
<h2 class="section-heading">Login</h2>
<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'signup/?$', SignupView.as_view(), name='signup'),
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",
'vm_types': VirtualMachineType.get_serialized_vm_types(),
}
return context
def get(self, request, *args, **kwargs):
request.session['hosting_url'] = reverse('hosting:djangohosting')
context = self.get_context_data()
return render(request, self.template_name, context)
@ -53,6 +54,7 @@ class RailsHostingView(ProcessVMSelectionMixin, View):
return context
def get(self, request, *args, **kwargs):
request.session['hosting_url'] = reverse('hosting:railshosting')
context = self.get_context_data()
return render(request, self.template_name, context)
@ -72,7 +74,7 @@ class NodeJSHostingView(ProcessVMSelectionMixin, View):
return context
def get(self, request, *args, **kwargs):
request.session['hosting_url'] = reverse('hosting:nodejshosting')
context = self.get_context_data()
return render(request, self.template_name, context)