Merge branch 'master' into task/3530/upgrade_to_django_1.11

This commit is contained in:
PCoder 2018-03-11 17:42:03 +01:00
commit fe760f6a01
9 changed files with 186 additions and 32 deletions

View file

@ -1,6 +1,11 @@
Next:
1.5: 2018-03-09
* #3554: [dcl] Remove some more beta access resources (some were left in the earlier release)
* #3452: [hosting] Back button management and cache control for hosting views
* #3718: [dcl] downtime page
* #4119: [dcl] CMS plugins for dcl pages
* #4231: [hosting] add company fiscal number to invoice footer
1.4.1: 2018-02-23
* bgfix: [dcl] fix header style for tos page
* #3798: [dg] Redirect user to digital glarus on clicking logo in the email
* #3554: [dcl] Remove beta access resources
* #4166: [glasfaser] heading text not to be blocked by topnav on mobile after navbar menu click

View file

@ -424,7 +424,7 @@ textarea {
}
.split-section.left .split-description {
width: 90%;
/* width: 90%; */
margin-right: auto;
}
@ -1281,4 +1281,4 @@ footer .dcl-link-separator::before {
.banner-list-heading h2 {
font-size: 30px;
}
}
}

View file

@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>ungleich</title>
<!-- Custom Fonts -->
<link href="//fonts.googleapis.com/css?family=Lato:300,400" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<style>
body {
color: #333;
font-family: Lato, sans-serif;
font-weight: 300;
font-size: 18px;
line-height: 1;
}
h1 {
padding-top: 4%;
font-weight: 300;
font-size: 48px;
text-align: center;
}
nav {
padding: 20px 15px;
}
.downtime-container {
max-width: 1200px;
margin: auto;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.downtime-msg {
text-align: center;
font-size: 26px;
}
.downtime-contact {
max-width: 300px;
margin: auto;
}
h2 {
font-weight: 300;
font-size: 22px;
text-align: center;
margin-bottom: 5px;
}
p {
margin: 15px auto
}
.xl_p {
margin: 15px auto;
}
a {
color: #333;
text-decoration: none;
}
a:hover, a:focus, a:active, a:active:focus {
color: #4a90e2;
}
</style>
</head>
<body>
<div class="downtime-container">
<nav class="navbar navbar-default topnav navbar-transparent" role="navigation">
<div class="container topnav">
<div class="navbar-header">
<a id="logoWhite" class="navbar-brand topnav" href="https://www.ungleich.ch/"><img src="https://www.ungleich.ch/static/datacenterlight/img/logo_black.svg"></a>
</div>
</div>
</nav>
<h1>You caught us while working!</h1>
<div class="downtime-msg">
<p class="xl_p">We're doing scheduled maintenance from</p>
<p class="xl_p">17:00 21.08.2017 to 23:00 21.08.2017 CEST.</p>
</div>
<h2>If you need immediate assistance, please contact us at</h2>
<div class="downtime-contact">
<p><a href="mailto:support@datacenterlight.ch">support@datacenterlight.ch</a></p>
<p>+41 044 534 66 22</p>
<p><a target="_blank" href="https://twitter.com/datacenterlight">twitter datacenterlight</a></p>
<p><a target="_blank" href="https://twitter.com/ungleich">twitter ungleich</a></p>
</div>
</div>
</body>
</html>

View file

@ -62,7 +62,7 @@
</div>
</div>
<div class="split-section left" id="your">
<div class="split-section left section-gradient" id="your">
<div class="container">
<div class="row">
<div class="col-sm-6">
@ -102,7 +102,7 @@
</div>
</div>
<div class="split-section pricing-section" id="price">
<div class="split-section pricing-section section-gradient" id="price">
<div class="container">
<div class="row">
<div class="col-md-6">

View file

@ -117,7 +117,7 @@
</div>
</div>
<div class="split-section pricing-section" id="price">
<div class="split-section pricing-section section-gradient" id="price">
<div class="container">
<div class="row">
<div class="col-md-6">

View file

@ -26,6 +26,7 @@ ALLOWED_HOSTS = [
".django-hosting.ch",
".node-hosting.ch",
".devuanhosting.ch",
".devuanhosting.com",
".digitalezukunft.ch",
".ipv6onlyhosting.ch",
".ipv6onlyhosting.com",

View file

@ -12,13 +12,14 @@ from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.core.urlresolvers import reverse_lazy, reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import redirect, render
from django.utils.http import urlsafe_base64_decode
from django.utils.safestring import mark_safe
from django.utils.translation import get_language, ugettext_lazy as _
from django.utils.translation import ugettext
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.generic import (
View, CreateView, FormView, ListView, DetailView, DeleteView,
TemplateView, UpdateView
@ -29,11 +30,14 @@ from stored_messages.api import mark_read
from stored_messages.models import Message
from stored_messages.settings import stored_messages_settings
from datacenterlight.models import VMTemplate
from datacenterlight.tasks import create_vm_task
from membership.models import CustomUser, StripeCustomer
from opennebula_api.models import OpenNebulaManager
from opennebula_api.serializers import VirtualMachineSerializer, \
VirtualMachineTemplateSerializer, VMTemplateSerializer
from opennebula_api.serializers import (
VirtualMachineSerializer, VirtualMachineTemplateSerializer,
VMTemplateSerializer
)
from utils.forms import (
BillingAddressForm, PasswordResetRequestForm, UserBillingAddressForm,
ResendActivationEmailForm
@ -46,19 +50,21 @@ from utils.views import (
PasswordResetViewMixin, PasswordResetConfirmViewMixin, LoginViewMixin,
ResendActivationLinkViewMixin
)
from .forms import HostingUserSignupForm, HostingUserLoginForm, \
UserHostingKeyForm, generate_ssh_key_name
from .forms import (
HostingUserSignupForm, HostingUserLoginForm, UserHostingKeyForm,
generate_ssh_key_name
)
from .mixins import ProcessVMSelectionMixin
from .models import (
HostingOrder, HostingBill, HostingPlan, UserHostingKey, VMDetail
)
from datacenterlight.models import VMTemplate
logger = logging.getLogger(__name__)
CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a \
backend connection error. please try again in a few \
minutes."
decorators = [never_cache]
class DashboardView(LoginRequiredMixin, View):
@ -69,6 +75,7 @@ class DashboardView(LoginRequiredMixin, View):
context = {}
return context
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
context = self.get_context_data()
return render(request, self.template_name, context)
@ -200,9 +207,9 @@ class IndexView(View):
}
return context
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
context = self.get_context_data()
return render(request, self.template_name, context)
@ -216,7 +223,7 @@ class SignupView(CreateView):
template_name = 'hosting/signup.html'
form_class = HostingUserSignupForm
model = CustomUser
success_url = reverse_lazy('hosting:ssh_keys')
success_url = reverse_lazy('hosting:dashboard')
def get_success_url(self):
next_url = self.request.session.get(
@ -234,6 +241,12 @@ class SignupView(CreateView):
return HttpResponseRedirect(reverse_lazy('hosting:signup-validate'))
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
if self.request.user.is_authenticated():
return HttpResponseRedirect(self.get_success_url())
return super(SignupView, self).get(request, *args, **kwargs)
class SignupValidateView(TemplateView):
template_name = "hosting/signup_validate.html"
@ -305,6 +318,12 @@ class SignupValidatedView(SignupValidateView):
context['section_title'] = section_title
return context
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
if self.request.user.is_authenticated():
return HttpResponseRedirect(reverse_lazy('hosting:dashboard'))
return super(SignupValidatedView, self).get(request, *args, **kwargs)
class ResendActivationEmailView(ResendActivationLinkViewMixin):
template_name = 'hosting/resend_activation_link.html'
@ -439,6 +458,7 @@ class SSHKeyListView(LoginRequiredMixin, ListView):
self.queryset = UserHostingKey.objects.filter(user=user)
return super(SSHKeyListView, self).get_queryset()
@method_decorator(decorators)
def render_to_response(self, context, **response_kwargs):
if not self.queryset:
return HttpResponseRedirect(reverse('hosting:choice_ssh_keys'))
@ -450,10 +470,12 @@ class SSHKeyChoiceView(LoginRequiredMixin, View):
template_name = "hosting/choice_ssh_keys.html"
login_url = reverse_lazy('hosting:login')
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
context = {}
return render(request, self.template_name, context)
@method_decorator(decorators)
def post(self, request, *args, **kwargs):
name = generate_ssh_key_name()
private_key, public_key = UserHostingKey.generate_keys()
@ -523,6 +545,11 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView):
manager.manage_public_key([{'value': public_key, 'state': True}])
return HttpResponseRedirect(self.success_url)
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
return render(request, self.template_name)
@method_decorator(decorators)
def post(self, request, *args, **kwargs):
form = self.get_form()
required = 'add_ssh' in self.request.POST
@ -570,6 +597,11 @@ class SettingsView(LoginRequiredMixin, FormView):
return context
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
return render(request, self.template_name)
@method_decorator(decorators)
def post(self, request, *args, **kwargs):
form = self.get_form()
if form.is_valid():
@ -632,11 +664,13 @@ class PaymentVMView(LoginRequiredMixin, FormView):
return context
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
if 'next' in request.session:
del request.session['next']
return self.render_to_response(self.get_context_data())
@method_decorator(decorators)
def post(self, request, *args, **kwargs):
form = self.get_form()
if form.is_valid():
@ -665,8 +699,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
return self.form_invalid(form)
class OrdersHostingDetailView(LoginRequiredMixin,
DetailView):
class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
template_name = "hosting/order_detail.html"
context_object_name = "order"
login_url = reverse_lazy('hosting:login')
@ -765,6 +798,7 @@ class OrdersHostingDetailView(LoginRequiredMixin,
context['vm'] = self.request.session.get('specs')
return context
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
if not self.kwargs.get('pk'):
if 'specs' not in self.request.session:
@ -786,6 +820,7 @@ class OrdersHostingDetailView(LoginRequiredMixin,
)
return self.render_to_response(context)
@method_decorator(decorators)
def post(self, request):
template = request.session.get('template')
specs = request.session.get('specs')
@ -892,6 +927,10 @@ class OrdersHostingListView(LoginRequiredMixin, ListView):
self.queryset = HostingOrder.objects.filter(customer__user=user)
return super(OrdersHostingListView, self).get_queryset()
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
return super(OrdersHostingListView, self).get(request, *args, **kwargs)
class OrdersHostingDeleteView(LoginRequiredMixin, DeleteView):
login_url = reverse_lazy('hosting:login')
@ -953,10 +992,12 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View):
if (value > 2000) or (value < 10):
raise ValidationError(_('Invalid storage size'))
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
context = {'templates': VMTemplate.objects.all()}
return render(request, self.template_name, context)
@method_decorator(decorators)
def post(self, request):
cores = request.POST.get('cpu')
cores_field = forms.IntegerField(validators=[self.validate_cores])
@ -1044,6 +1085,7 @@ class VirtualMachineView(LoginRequiredMixin, View):
final_url = reverse('hosting:virtual_machines')
return final_url
@method_decorator(decorators)
def get(self, request, *args, **kwargs):
vm = self.get_object()
if vm is None:
@ -1078,6 +1120,7 @@ class VirtualMachineView(LoginRequiredMixin, View):
return render(request, self.template_name, context)
@method_decorator(decorators)
def post(self, request, *args, **kwargs):
response = {'status': False}
admin_email_body = {}

View file

@ -1,20 +1,18 @@
{% load cms_tags custom_tags %}
<section id="{{section_id}}" class="products-section {% if product_instance.section_class %}{{ product_instance.section_class }}{% else %}bg-light-gray{% endif %}">
<div id="portfolio">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center wow fadeInDown" style="visibility: visible; animation-name: fadeInDown;">
<h2 class="section-heading">{{ product_instance.title }}</h2>
{{ product_instance.sub_title }}
</div>
</div>
<div class="row">
{% for plugin in product_instance.child_plugin_instances %}
<div class="col-md-4 col-sm-6 portfolio-item wow fadeInUp" data-wow-delay="{{ forloop.counter|multiply:0.25 }}s" style="visibility: visible; animation-delay: {{ forloop.counter|multiply:0.25 }}s; animation-name: fadeInUp;">
{% render_plugin plugin %}
</div>
{% endfor %}
<div class="container">
<div class="text-center wow fadeInDown section-heading-contain">
<h2 class="section-heading">{{ product_instance.title }}</h2>
{{ product_instance.sub_title }}
</div>
<div class="row">
{% for plugin in product_instance.child_plugin_instances %}
<div class="col-md-4 col-sm-6 portfolio-item wow fadeInUp" data-wow-delay="{{ forloop.counter|multiply:0.25 }}s" style="visibility: visible; animation-delay: {{ forloop.counter|multiply:0.25 }}s; animation-name: fadeInUp;">
{% render_plugin plugin %}
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</section>
</div>
</section>

View file

@ -8,6 +8,7 @@ from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.utils.translation import ugettext_lazy as _
from django.views.generic import FormView, CreateView
from django.views.decorators.cache import cache_control
from membership.models import CustomUser
from .forms import SetPasswordForm
@ -57,6 +58,7 @@ class LoginViewMixin(FormView):
return HttpResponseRedirect(self.get_success_url())
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
def get(self, request, *args, **kwargs):
if self.request.user.is_authenticated():
return HttpResponseRedirect(self.get_success_url())