From f226c551a88bfd18832251ddc66e3b62b50a5a2b Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 00:06:21 +0100 Subject: [PATCH 001/162] Add stripe_subscription_id field to MembershipOrder --- ..._membershiporder_stripe_subscription_id.py | 20 +++++++++++++++++++ digitalglarus/models.py | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 digitalglarus/migrations/0025_membershiporder_stripe_subscription_id.py diff --git a/digitalglarus/migrations/0025_membershiporder_stripe_subscription_id.py b/digitalglarus/migrations/0025_membershiporder_stripe_subscription_id.py new file mode 100644 index 00000000..127d5ff8 --- /dev/null +++ b/digitalglarus/migrations/0025_membershiporder_stripe_subscription_id.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2017-12-23 22:56 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('digitalglarus', '0024_bookingcancellation'), + ] + + operations = [ + migrations.AddField( + model_name='membershiporder', + name='stripe_subscription_id', + field=models.CharField(max_length=100, null=True), + ), + ] diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 16d6b639..9cae88ed 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -129,6 +129,7 @@ class MembershipOrder(Ordereable, models.Model): membership = models.ForeignKey(Membership) start_date = models.DateField() end_date = models.DateField() + stripe_subscription_id = models.CharField(max_length=100, null=True) @classmethod def current_membership_dates(cls, user): @@ -172,10 +173,12 @@ class MembershipOrder(Ordereable, models.Model): @classmethod def create(cls, data): stripe_charge = data.pop('stripe_charge', None) + stripe_subscription_id = data.pop('stripe_subscription_id', None) instance = cls.objects.create(**data) instance.stripe_charge_id = stripe_charge.id instance.last4 = stripe_charge.source.last4 instance.cc_brand = stripe_charge.source.brand + instance.stripe_subscription_id = stripe_subscription_id instance.save() return instance From 872582f45ff3dc977726d8473320a47376dab0f0 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 00:08:17 +0100 Subject: [PATCH 002/162] Add tentative code to subscribe customer to Stripe plan (wip) --- digitalglarus/views.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 96983d9b..a45defd3 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -375,6 +375,28 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): }) return render(request, self.template_name, context) + # Subscribe the customer to dg plan from the next month onwards + stripe_plan = stripe_utils.get_or_create_stripe_plan( + amount=membership_type.price, + name='Digital Glarus {sub_type_name} Subscription'.format( + sub_type_name=membership_type.name + ), + stripe_plan_id='dg-{sub_type_name}'.format( + sub_type_name=membership_type.name + ) + ) + subscription_result = stripe_utils.subscribe_customer_to_plan( + customer.stripe_id, + [{"plan": stripe_plan.get('response_object').stripe_plan_id}] + ) + stripe_subscription_obj = subscription_result.get( + 'response_object' + ) + # Check if the subscription was approved and is active + if (stripe_subscription_obj is None + or stripe_subscription_obj.status != 'active'): + pass + charge = charge_response.get('response_object') if 'source' in charge: cardholder_name = charge['source']['name'] From b2d0fd45ad5d6234537b408bbc242b48dc66f55a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 00:21:25 +0100 Subject: [PATCH 003/162] Fix PEP8 error --- digitalglarus/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index a45defd3..017dd090 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -393,8 +393,8 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): 'response_object' ) # Check if the subscription was approved and is active - if (stripe_subscription_obj is None - or stripe_subscription_obj.status != 'active'): + if (stripe_subscription_obj is None or + stripe_subscription_obj.status != 'active'): pass charge = charge_response.get('response_object') From 6fa8dbb5cb4a20f487f45cbf24f668c6149da7b5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:32:08 +0100 Subject: [PATCH 004/162] Add trial_end parameter to subscribe_customer_to_plan --- utils/stripe_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index 58840be0..79bca243 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -210,12 +210,14 @@ class StripeUtils(object): return return_value @handleStripeError - def subscribe_customer_to_plan(self, customer, plans): + def subscribe_customer_to_plan(self, customer, plans, trial_end=None): """ Subscribes the given customer to the list of given plans :param customer: The stripe customer identifier :param plans: A list of stripe plans. + :param trial_end: An integer representing when the Stripe subscription + is supposed to end Ref: https://stripe.com/docs/api/python#create_subscription-items e.g. plans = [ @@ -227,8 +229,7 @@ class StripeUtils(object): """ subscription_result = self.stripe.Subscription.create( - customer=customer, - items=plans, + customer=customer, items=plans, trial_end=trial_end ) return subscription_result From 009128135711a80ccdef58026e82462d7d31ccaf Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:45:59 +0100 Subject: [PATCH 005/162] Add next_month_in_sec_since_epoch MembershipType function --- digitalglarus/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 9cae88ed..ffd98029 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -59,6 +59,17 @@ class MembershipType(models.Model): return "{} - {}".format(datetime.strftime(start_date, "%b, %d %Y"), datetime.strftime(end_date, "%b, %d %Y")) + @cached_property + def next_month_in_sec_since_epoch(self): + """ + First day of the next month expressed in seconds since the epoch time + :return: Time in seconds + """ + start_date, end_date = self.first_month_range + first_day_next_month = end_date + timedelta(days=1) + epoch_time = int(time.mktime(first_day_next_month.timetuple())) + return epoch_time + class Membership(models.Model): type = models.ForeignKey(MembershipType) From 11b8ebe401919d635e2908c24191bbeb072252a9 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:46:36 +0100 Subject: [PATCH 006/162] Import time --- digitalglarus/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/digitalglarus/models.py b/digitalglarus/models.py index ffd98029..39ee356e 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -1,6 +1,7 @@ import calendar +import time from datetime import datetime, date, timedelta from dateutil.relativedelta import relativedelta from django.db import models From 3826ca207ae7c08b6d3628c404403e8538d9957c Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:48:03 +0100 Subject: [PATCH 007/162] Reformat code --- digitalglarus/views.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 017dd090..4efa21db 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -355,16 +355,21 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): membership_type = data.get('membership_type') # Get or create stripe customer - customer = StripeCustomer.get_or_create(email=self.request.user.email, - token=token) + customer = StripeCustomer.get_or_create( + email=self.request.user.email, token=token + ) if not customer: form.add_error("__all__", "Invalid credit card") - return self.render_to_response(self.get_context_data(form=form)) + return self.render_to_response( + self.get_context_data(form=form) + ) # Make stripe charge to a customer stripe_utils = StripeUtils() - charge_response = stripe_utils.make_charge(amount=membership_type.first_month_price, - customer=customer.stripe_id) + charge_response = stripe_utils.make_charge( + amount=membership_type.first_month_price, + customer=customer.stripe_id + ) charge = charge_response.get('response_object') # Check if the payment was approved From f5170cce5f9f88739f792cc653fd3497be0cb09a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:51:16 +0100 Subject: [PATCH 008/162] Call DG subscribe_customer_to_plan with trial period until first of next month --- digitalglarus/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 4efa21db..ff567036 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -392,7 +392,8 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): ) subscription_result = stripe_utils.subscribe_customer_to_plan( customer.stripe_id, - [{"plan": stripe_plan.get('response_object').stripe_plan_id}] + [{"plan": stripe_plan.get('response_object').stripe_plan_id}], + trial_end=membership_type.next_month_in_sec_since_epoch ) stripe_subscription_obj = subscription_result.get( 'response_object' From 3ed6119dc9b58536d0a22aa998a9006d77090489 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:53:23 +0100 Subject: [PATCH 009/162] Check if DG subscription created was under trial; if not show error --- digitalglarus/views.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index ff567036..e163359c 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -398,10 +398,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): stripe_subscription_obj = subscription_result.get( 'response_object' ) - # Check if the subscription was approved and is active + # Check if call to create subscription was ok if (stripe_subscription_obj is None or - stripe_subscription_obj.status != 'active'): - pass + ( + stripe_subscription_obj.status != 'active' and + stripe_subscription_obj.status != 'trialing' + ) + ): + context.update({ + 'paymentError': subscription_result.get('error'), + 'form': form + }) + return render(request, self.template_name, context) charge = charge_response.get('response_object') if 'source' in charge: From f6d0b6ce9c32e03ec0a3b4ea87125a7f581036b7 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 12:54:59 +0100 Subject: [PATCH 010/162] Add stripe_subscription_id to MembershipOrder data --- digitalglarus/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index e163359c..d3e69e99 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -448,6 +448,7 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): 'customer': customer, 'billing_address': billing_address, 'stripe_charge': charge, + 'stripe_subscription_id': stripe_subscription_obj.id, 'amount': membership_type.first_month_price, 'start_date': membership_start_date, 'end_date': membership_end_date From b4421bc9b2eda0b69e5e3b6de10318d944e5df99 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 13:06:23 +0100 Subject: [PATCH 011/162] Reformat code --- digitalglarus/models.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 39ee356e..e41098ac 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -83,9 +83,10 @@ class Membership(models.Model): @classmethod def get_current_membership(cls, user): - - has_order_current_month = Q(membershiporder__customer__user=user, - membershiporder__created_at__month=datetime.today().month) + has_order_current_month = Q( + membershiporder__customer__user=user, + membershiporder__created_at__month=datetime.today().month + ) # import pdb;pdb.set_trace() return cls.objects.\ filter(has_order_current_month).last() @@ -108,18 +109,23 @@ class Membership(models.Model): def activate_or_crete(cls, data, user): membership = cls.get_by_user(user) membership_id = membership.id if membership else None - obj, created = cls.objects.update_or_create(id=membership_id, defaults=data) + obj, created = cls.objects.update_or_create( + id=membership_id, defaults=data + ) return obj @classmethod def is_digitalglarus_active_member(cls, user): # past_month = (datetime.today() - relativedelta(months=1)).month - has_order_current_month = Q(membershiporder__customer__user=user, - membershiporder__created_at__month=datetime.today().month) + has_order_current_month = Q( + membershiporder__customer__user=user, + membershiporder__created_at__month=datetime.today().month + ) # has_order_past_month = Q(membershiporder__customer__user=user, # membershiporder__created_at__month=past_month) active_membership = Q(active=True) - # return cls.objects.filter(has_order_past_month | has_order_current_month).\ + # return cls.objects.filter( + # has_order_past_month | has_order_current_month).\ return cls.objects.filter(has_order_current_month).\ filter(active_membership).exists() From b19c3bdcde730bbbb375e6ed0532d4396e939a1d Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 13:15:48 +0100 Subject: [PATCH 012/162] Reformat code --- digitalglarus/models.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/digitalglarus/models.py b/digitalglarus/models.py index e41098ac..743457d1 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -88,8 +88,7 @@ class Membership(models.Model): membershiporder__created_at__month=datetime.today().month ) # import pdb;pdb.set_trace() - return cls.objects.\ - filter(has_order_current_month).last() + return cls.objects.filter(has_order_current_month).last() # def get_current_active_membership(cls, user): # membership = cls.get_current_membership(user) @@ -97,8 +96,7 @@ class Membership(models.Model): @classmethod def get_by_user(cls, user): - return cls.objects.\ - filter(membershiporder__customer__user=user).last() + return cls.objects.filter(membershiporder__customer__user=user).last() @classmethod def create(cls, data): From 63215b1c42be0c663b7bbf76ef935c37c0ec9f17 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 13:35:53 +0100 Subject: [PATCH 013/162] Organize imports --- digitalglarus/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 743457d1..fc4289aa 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -1,7 +1,6 @@ - - import calendar import time + from datetime import datetime, date, timedelta from dateutil.relativedelta import relativedelta from django.db import models From 707e1897b3b1e02c89eba1de3e383d452993e62e Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 14:23:33 +0100 Subject: [PATCH 014/162] Reorganize imports --- digitalglarus/views.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index d3e69e99..fc5186f4 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -9,20 +9,31 @@ from django.utils.translation import get_language from djangocms_blog.models import Post from django.contrib import messages from django.views.generic import DetailView, ListView -from .models import Supporter -from .mixins import ChangeMembershipStatusMixin from utils.forms import ContactUsForm from utils.mailer import BaseEmail from django.views.generic.edit import FormView from membership.models import StripeCustomer -from utils.views import LoginViewMixin, SignupViewMixin, \ - PasswordResetViewMixin, PasswordResetConfirmViewMixin -from utils.forms import PasswordResetRequestForm, UserBillingAddressForm, EditCreditCardForm +from utils.views import ( + LoginViewMixin, SignupViewMixin, PasswordResetViewMixin, + PasswordResetConfirmViewMixin +) +from utils.forms import ( + PasswordResetRequestForm, UserBillingAddressForm, EditCreditCardForm +) from utils.stripe_utils import StripeUtils from utils.models import UserBillingAddress -from .forms import LoginForm, SignupForm, MembershipBillingForm, BookingDateForm,\ +from .forms import ( + LoginForm, SignupForm, MembershipBillingForm, BookingDateForm, BookingBillingForm, CancelBookingForm +) +from .models import ( + MembershipType, Membership, MembershipOrder, Booking, BookingPrice, + BookingOrder, BookingCancellation, Supporter +) +from .mixins import ( + MembershipRequiredMixin, IsNotMemberMixin, ChangeMembershipStatusMixin +) from .models import MembershipType, Membership, MembershipOrder, Booking, BookingPrice,\ BookingOrder, BookingCancellation From 29c24574aa4e67e76e30ae3a64d0e7c16acb15ba Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 14:25:04 +0100 Subject: [PATCH 015/162] Cancel subscription on membership deactivation + some more reorganizes + import logger --- digitalglarus/views.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index fc5186f4..7576eb36 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -1,3 +1,5 @@ +import logging + from django.conf import settings from django.shortcuts import render from django.http import HttpResponseRedirect @@ -35,10 +37,7 @@ from .mixins import ( MembershipRequiredMixin, IsNotMemberMixin, ChangeMembershipStatusMixin ) -from .models import MembershipType, Membership, MembershipOrder, Booking, BookingPrice,\ - BookingOrder, BookingCancellation - -from .mixins import MembershipRequiredMixin, IsNotMemberMixin +logger = logging.getLogger(__name__) class IndexView(TemplateView): @@ -282,7 +281,6 @@ class BookingPaymentView(LoginRequiredMixin, MembershipRequiredMixin, FormView): booking_data = { 'start_date': start_date, 'end_date': end_date, - 'start_date': start_date, 'free_days': free_days, 'price': normal_price, 'final_price': final_price, @@ -529,8 +527,29 @@ class MembershipDeactivateView(LoginRequiredMixin, UpdateView): def post(self, *args, **kwargs): membership = self.get_object() membership.deactivate() - - messages.add_message(self.request, messages.SUCCESS, self.success_message) + messages.add_message( + self.request, messages.SUCCESS, self.success_message + ) + # cancel Stripe subscription + stripe_utils = StripeUtils() + membership_order = MembershipOrder.objects.filter( + customer__user=self.request.user + ).last() + if membership_order.subscription_id: + result = stripe_utils.unsubscribe_customer( + subscription_id=membership_order.subscription_id + ) + stripe_subscription_obj = result.get('response_object') + # Check if the subscription was canceled + if (stripe_subscription_obj is None or + stripe_subscription_obj.status != 'canceled'): + error_msg = result.get('error') + logger.error( + "Could not cancel Digital Glarus subscription. Reason: " + "{reason}".format( + reason=error_msg + ) + ) return HttpResponseRedirect(self.success_url) From eb067f57084325e518b607fa72a776842c1c7d31 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 14:38:32 +0100 Subject: [PATCH 016/162] Refactor code and log messages for possible errors --- digitalglarus/views.py | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 7576eb36..fa601d8d 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -535,21 +535,35 @@ class MembershipDeactivateView(LoginRequiredMixin, UpdateView): membership_order = MembershipOrder.objects.filter( customer__user=self.request.user ).last() - if membership_order.subscription_id: - result = stripe_utils.unsubscribe_customer( - subscription_id=membership_order.subscription_id - ) - stripe_subscription_obj = result.get('response_object') - # Check if the subscription was canceled - if (stripe_subscription_obj is None or - stripe_subscription_obj.status != 'canceled'): - error_msg = result.get('error') + if membership_order: + if membership_order.subscription_id: + result = stripe_utils.unsubscribe_customer( + subscription_id=membership_order.subscription_id + ) + stripe_subscription_obj = result.get('response_object') + # Check if the subscription was canceled + if (stripe_subscription_obj is None or + stripe_subscription_obj.status != 'canceled'): + error_msg = result.get('error') + logger.error( + "Could not cancel Digital Glarus subscription. " + "Reason: {reason}".format( + reason=error_msg + ) + ) + else: logger.error( - "Could not cancel Digital Glarus subscription. Reason: " - "{reason}".format( - reason=error_msg + "User {user} may have Stripe subscriptions created " + "manually. Please check.".format( + user=self.request.user.name ) ) + else: + logger.error( + "MembershipOrder for {user} not found".format( + user=self.request.user.name + ) + ) return HttpResponseRedirect(self.success_url) From 89d70a2b6a1642ef1d9028f1efdc903139a6e192 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 15:04:20 +0100 Subject: [PATCH 017/162] Fix bug: rename subscription_id to stripe_subscription_id --- digitalglarus/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index fa601d8d..2bb1ee32 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -536,9 +536,9 @@ class MembershipDeactivateView(LoginRequiredMixin, UpdateView): customer__user=self.request.user ).last() if membership_order: - if membership_order.subscription_id: + if membership_order.stripe_subscription_id: result = stripe_utils.unsubscribe_customer( - subscription_id=membership_order.subscription_id + subscription_id=membership_order.stripe_subscription_id ) stripe_subscription_obj = result.get('response_object') # Check if the subscription was canceled From ca2a90ca2d88f1000437caa6620ceb68d4f54aba Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 18:06:17 +0100 Subject: [PATCH 018/162] On reactivate, take user to pricing page --- .../templates/digitalglarus/membership_orders_list.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/membership_orders_list.html b/digitalglarus/templates/digitalglarus/membership_orders_list.html index ceeea6f1..ccce1121 100644 --- a/digitalglarus/templates/digitalglarus/membership_orders_list.html +++ b/digitalglarus/templates/digitalglarus/membership_orders_list.html @@ -95,10 +95,10 @@ Deactivate {% elif not current_membership.active %} -
- {% csrf_token %} + + {% csrf_token %}
- +
{% endif %} From a34bd83c5e2d174d26c3fae601510c0e25fe8727 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 18:07:30 +0100 Subject: [PATCH 019/162] Refactor reactivate link html --- .../templates/digitalglarus/membership_orders_list.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/membership_orders_list.html b/digitalglarus/templates/digitalglarus/membership_orders_list.html index ccce1121..dd49837d 100644 --- a/digitalglarus/templates/digitalglarus/membership_orders_list.html +++ b/digitalglarus/templates/digitalglarus/membership_orders_list.html @@ -95,12 +95,9 @@ Deactivate {% elif not current_membership.active %} -
- {% csrf_token %}
- + Reactivate
-
{% endif %} {% else %}
From a3f212a59ea090fd1f8da6947f72d3e696b06cbe Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 18:33:24 +0100 Subject: [PATCH 020/162] Fix PEP8 error --- digitalglarus/views.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 2bb1ee32..3b12934f 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -409,11 +409,8 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): ) # Check if call to create subscription was ok if (stripe_subscription_obj is None or - ( - stripe_subscription_obj.status != 'active' and - stripe_subscription_obj.status != 'trialing' - ) - ): + (stripe_subscription_obj.status != 'active' and + stripe_subscription_obj.status != 'trialing')): context.update({ 'paymentError': subscription_result.get('error'), 'form': form From 3489640afe979acd5998f20f858d1961498f9d0a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Dec 2017 21:17:52 +0100 Subject: [PATCH 021/162] Add DG signup clarification line --- digitalglarus/templates/digitalglarus/signup.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/digitalglarus/templates/digitalglarus/signup.html b/digitalglarus/templates/digitalglarus/signup.html index aea83f4e..78b130fb 100644 --- a/digitalglarus/templates/digitalglarus/signup.html +++ b/digitalglarus/templates/digitalglarus/signup.html @@ -29,6 +29,9 @@
+
From 251b5d7495361195115eedb4a67a0e315410fc59 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Wed, 27 Dec 2017 11:03:12 +0100 Subject: [PATCH 022/162] Remove a whitespace --- digitalglarus/templates/digitalglarus/signup.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/signup.html b/digitalglarus/templates/digitalglarus/signup.html index 78b130fb..063dcee4 100644 --- a/digitalglarus/templates/digitalglarus/signup.html +++ b/digitalglarus/templates/digitalglarus/signup.html @@ -29,7 +29,7 @@
-
@@ -59,4 +59,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} From e6931534abc3ce8303e9446b7198f6ea44b7e0b9 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Wed, 27 Dec 2017 18:09:45 +0100 Subject: [PATCH 023/162] Load i18n in ungleich_page's _header_with_background_video_slider_item.html --- .../ungleich/_header_with_background_video_slider_item.html | 1 + 1 file changed, 1 insertion(+) diff --git a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html b/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html index a576684f..78bb7ad8 100644 --- a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html +++ b/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html @@ -1,3 +1,4 @@ +{% load i18n %} {% if instance.image %}
{% endif %} From 31895688849eabf3124c075293045f692e518400 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 20:04:20 +0100 Subject: [PATCH 024/162] Send emails to admin when Stripe transaction error --- digitalglarus/views.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 3b12934f..32d8e1f5 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -24,6 +24,7 @@ from utils.forms import ( ) from utils.stripe_utils import StripeUtils from utils.models import UserBillingAddress +from utils.tasks import send_plain_email_task from .forms import ( LoginForm, SignupForm, MembershipBillingForm, BookingDateForm, @@ -387,6 +388,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): 'paymentError': charge_response.get('error'), 'form': form }) + email_to_admin_data = { + 'subject': "Could not create charge for Digital Glarus " + "user: {user}".format( + user=self.request.user.email + ), + 'from_email': 'info@digitalglarus.ch', + 'to': ['info@ungleich.ch'], + 'body': "\n".join( + ["%s=%s" % (k, v) for (k, v) in + charge_response.items()]), + } + send_plain_email_task.delay(email_to_admin_data) return render(request, self.template_name, context) # Subscribe the customer to dg plan from the next month onwards @@ -415,6 +428,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): 'paymentError': subscription_result.get('error'), 'form': form }) + email_to_admin_data = { + 'subject': "Could not create Stripe subscription for " + "Digital Glarus user: {user}".format( + user=self.request.user.email + ), + 'from_email': 'info@digitalglarus.ch', + 'to': ['info@ungleich.ch'], + 'body': "\n".join( + ["%s=%s" % (k, v) for (k, v) in + subscription_result.items()]), + } + send_plain_email_task.delay(email_to_admin_data) return render(request, self.template_name, context) charge = charge_response.get('response_object') From 0abd165c8e32c0ed0db3a388f32b3de89a938ba4 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 20:21:37 +0100 Subject: [PATCH 025/162] Skip test_post if Stripe API key is not provided --- digitalglarus/test_views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/digitalglarus/test_views.py b/digitalglarus/test_views.py index cdd23bad..b7fc6c3a 100644 --- a/digitalglarus/test_views.py +++ b/digitalglarus/test_views.py @@ -1,5 +1,5 @@ from model_mommy import mommy -from unittest import mock +from unittest import mock, skipIf from django.test import TestCase from django.conf import settings @@ -126,6 +126,11 @@ class MembershipPaymentViewTest(BaseTestCase): self.assertEqual(response.context['membership_type'], self.membership_type) + @skipIf( + settings.STRIPE_API_PRIVATE_KEY_TEST is None or + settings.STRIPE_API_PRIVATE_KEY_TEST is "", + """Stripe details unavailable, so skipping CeleryTaskTestCase""" + ) @mock.patch('utils.stripe_utils.StripeUtils.create_customer') def test_post(self, stripe_mocked_call): From 01b8266b613bc50e1611d546c1fcf5d1baf9bdbf Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 20:37:34 +0100 Subject: [PATCH 026/162] Update Changelog --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index 1ad8f324..63c4fd07 100644 --- a/Changelog +++ b/Changelog @@ -8,6 +8,7 @@ Next: * #3601: [dcl, hosting] Change minimum required RAM from 2GB to 1GB * #3973: [dcl] Update datacenterlight and glasfaser contact address to Linthal and company name to "ungleich glarus ag" * #3993: [dg] Fix new user membership payment by setting cardholder_name field for UserBillingAddressForm + * #3799: [dg] Make digital glarus billing work as monthly subscription 1.2.13: 2017-12-09 * [cms] Introduce UngleichHeaderBackgroundImageAndTextSliderPlugin that allows to have scrolling images and texts * [cms] Remove

tag for ungleich cms customer item template From 23c4069ebd8d36a606087de2b8c7c8b180f3a296 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 21:31:53 +0100 Subject: [PATCH 027/162] Update Changelog for release 1.3 --- Changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 63c4fd07..cb078924 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,4 @@ -Next: +1.3: 2017-12-27 * #3911: [dcl] Integrate resend activation link into dcl landing payment page * #3972: [hosting] Add ungleich company info to invoice footer * #3974: [hosting] Improve invoice number: Show 404 for invoice resources that do not belong to the user @@ -9,6 +9,7 @@ Next: * #3973: [dcl] Update datacenterlight and glasfaser contact address to Linthal and company name to "ungleich glarus ag" * #3993: [dg] Fix new user membership payment by setting cardholder_name field for UserBillingAddressForm * #3799: [dg] Make digital glarus billing work as monthly subscription + * #3994: [dg] Add a line on signup for clarifying dcl users can login without new signup 1.2.13: 2017-12-09 * [cms] Introduce UngleichHeaderBackgroundImageAndTextSliderPlugin that allows to have scrolling images and texts * [cms] Remove

tag for ungleich cms customer item template From 34f841afd4206d93e650cd83b1a60ded136af1df Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 21:47:29 +0100 Subject: [PATCH 028/162] Update Changelog --- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index cb078924..d4c517b8 100644 --- a/Changelog +++ b/Changelog @@ -2,7 +2,7 @@ * #3911: [dcl] Integrate resend activation link into dcl landing payment page * #3972: [hosting] Add ungleich company info to invoice footer * #3974: [hosting] Improve invoice number: Show 404 for invoice resources that do not belong to the user - * [ungleich] Add video cover to the header on ungleich.ch landing page and add corresponding cms plugin + * #3961: [ungleich] Add video cover to the header on ungleich.ch landing page and add corresponding cms plugin * #3774: [hosting] Update Stripe subscription on vm delete * [ungleich] Update text on landing page * #3601: [dcl, hosting] Change minimum required RAM from 2GB to 1GB From b0993d8728f18e9544681400f64c28642a763207 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 23:44:27 +0100 Subject: [PATCH 029/162] Fix address: Bahnhotstrasse to Bahnhofstrasse --- hosting/templates/hosting/order_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 6ea4f36f..2b062b55 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -155,7 +155,7 @@ {% endblock submit_btn %} {% else %}

{% endif %} From f2f1c61739eb6c402083ce02f5a22c2f564086ca Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 27 Dec 2017 23:59:40 +0100 Subject: [PATCH 030/162] Remove margin from a tags for explanation text --- digitalglarus/templates/digitalglarus/signup.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/signup.html b/digitalglarus/templates/digitalglarus/signup.html index 063dcee4..6a46294a 100644 --- a/digitalglarus/templates/digitalglarus/signup.html +++ b/digitalglarus/templates/digitalglarus/signup.html @@ -29,8 +29,8 @@
-
From f5db08e3dff1ac14d54ff54027e3f2b9803d4290 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 28 Dec 2017 13:14:59 +0100 Subject: [PATCH 031/162] Update psycopg2 from 2.7.1 to 2.7.3.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2ff887a7..7a325357 100644 --- a/requirements.txt +++ b/requirements.txt @@ -67,7 +67,7 @@ lxml==3.6.0 model-mommy==1.2.6 phonenumbers==7.4.0 phonenumberslite==7.4.0 -psycopg2==2.7.1 +psycopg2==2.7.3.2 pycryptodome==3.4 pylibmc==1.5.1 python-dateutil==2.5.3 From a4ff33f0fd1c39b24530714652d44eeb2bfe1cef Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 29 Dec 2017 18:50:58 +0530 Subject: [PATCH 032/162] Update Changelog --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index d4c517b8..015600bb 100644 --- a/Changelog +++ b/Changelog @@ -16,6 +16,7 @@ 1.2.12: 2017-12-09 * #3594: [digitalglarus] Remove white scroll bar on the right in mobile * #3905: [ungleich] Update ungleich.ch header into a slider + * #3968: [ungleich] Fix navbar logo alignment * [all] Enable logging custom modules 1.2.11: 2017-11-30 * [all] TravisCI: Test against python 3.4.2 only From ace2abc47e11044dc806dc81b324fc6c61caf4de Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 31 Dec 2017 00:58:37 +0100 Subject: [PATCH 033/162] Obtain email host, port and tls settings from env --- dynamicweb/settings/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 67734052..d66093ed 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -63,8 +63,12 @@ LOGIN_URL = None LOGOUT_URL = None LOGIN_REDIRECT_URL = None -EMAIL_HOST = "localhost" -EMAIL_PORT = 25 +EMAIL_HOST = env("EMAIL_HOST") +if not EMAIL_HOST: + EMAIL_HOST = "localhost" +EMAIL_PORT = int_env("EMAIL_PORT", 25) +EMAIL_USE_TLS = bool_env("EMAIL_USE_TLS") + SECRET_KEY = env('DJANGO_SECRET_KEY') # Application definition From 554335ae19134a04b5c602005647666b98d40a39 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 31 Dec 2017 18:28:41 +0100 Subject: [PATCH 034/162] Update Changelog for 1.3.1 --- Changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog b/Changelog index 015600bb..4a9945f9 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +1.3.1: 2017-12-31 + * feature: [all] Load email configurations host, port and use_tls from env + * bugfix: [all] Use ungleich's smtp as relayhost for sending emails 1.3: 2017-12-27 * #3911: [dcl] Integrate resend activation link into dcl landing payment page * #3972: [hosting] Add ungleich company info to invoice footer From 43999d803a8a3deb67bc7b94f359ce2a9f808097 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Jan 2018 08:43:57 +0100 Subject: [PATCH 035/162] Add sdd_size, hdd_size to VirtualMachineSerializer --- opennebula_api/serializers.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/opennebula_api/serializers.py b/opennebula_api/serializers.py index 662b2fb6..07506a8b 100644 --- a/opennebula_api/serializers.py +++ b/opennebula_api/serializers.py @@ -49,6 +49,8 @@ class VirtualMachineSerializer(serializers.Serializer): memory = serializers.SerializerMethodField() disk_size = serializers.SerializerMethodField() + hdd_size = serializers.SerializerMethodField() + sdd_size = serializers.SerializerMethodField() ipv4 = serializers.SerializerMethodField() ipv6 = serializers.SerializerMethodField() vm_id = serializers.IntegerField(read_only=True, source='id') @@ -102,6 +104,22 @@ class VirtualMachineSerializer(serializers.Serializer): disk_size += int(disk.size) return disk_size / 1024 + def get_sdd_size(self, obj): + template = obj.template + disk_size = 0 + for disk in template.disks: + if disk.datastore == 'cephds': + disk_size += int(disk.size) + return disk_size / 1024 + + def get_hdd_size(self, obj): + template = obj.template + disk_size = 0 + for disk in template.disks: + if disk.datastore == 'ceph_hdd_ds': + disk_size += int(disk.size) + return disk_size / 1024 + def get_price(self, obj): template = obj.template price = float(template.vcpu) * 5.0 From 3d1738871b76fb0dcffd343a7a49603d97c0c5da Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Jan 2018 08:54:19 +0100 Subject: [PATCH 036/162] Replace all ungleich.com with ungleich.ch --- digitalglarus/test_views.py | 2 +- hosting/test_forms.py | 2 +- hosting/test_views.py | 2 +- utils/mailer.py | 2 +- utils/tests.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/digitalglarus/test_views.py b/digitalglarus/test_views.py index b7fc6c3a..aff11081 100644 --- a/digitalglarus/test_views.py +++ b/digitalglarus/test_views.py @@ -224,7 +224,7 @@ class SignupViewTest(TestCase): self.view = SignupView self.signup_data = { 'name': 'ungleich', - 'email': 'test@ungleich.com', + 'email': 'test@ungleich.ch', 'password': 'fake_password', 'confirm_password': 'fake_password', } diff --git a/hosting/test_forms.py b/hosting/test_forms.py index 89ddb268..3dd4f8ff 100644 --- a/hosting/test_forms.py +++ b/hosting/test_forms.py @@ -30,7 +30,7 @@ class HostingUserSignupFormTest(TestCase): def setUp(self): self.completed_data = { 'name': 'test name', - 'email': 'test@ungleich.com', + 'email': 'test@ungleich.ch', 'password': 'test_password', 'confirm_password': 'test_password' } diff --git a/hosting/test_views.py b/hosting/test_views.py index 2c71959a..324aa4fa 100644 --- a/hosting/test_views.py +++ b/hosting/test_views.py @@ -505,7 +505,7 @@ class SignupViewTest(TestCase): self.view = SignupView self.signup_data = { 'name': 'ungleich', - 'email': 'test@ungleich.com', + 'email': 'test@ungleich.ch', 'password': 'fake_password', 'confirm_password': 'fake_password', } diff --git a/utils/mailer.py b/utils/mailer.py index d626e733..ae1d96da 100644 --- a/utils/mailer.py +++ b/utils/mailer.py @@ -25,7 +25,7 @@ class BaseEmail(object): self.email.from_email = kwargs.get('from_address') else: self.email.from_email = '(ungleich) ungleich Support ' - self.email.to = [kwargs.get('to', 'info@ungleich.com')] + self.email.to = [kwargs.get('to', 'info@ungleich.ch')] def send(self): self.email.send() diff --git a/utils/tests.py b/utils/tests.py index ce54800a..8abbbb1d 100644 --- a/utils/tests.py +++ b/utils/tests.py @@ -44,7 +44,7 @@ class BaseTestCase(TestCase): # Request Object self.request = HttpRequest() - self.request.META['SERVER_NAME'] = 'ungleich.com' + self.request.META['SERVER_NAME'] = 'ungleich.ch' self.request.META['SERVER_PORT'] = '80' def get_client(self, user): From 74626a59dcd604eb31c56297e0559cd0ab217743 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 5 Jan 2018 05:18:35 +0530 Subject: [PATCH 037/162] galsfaser section cms plugin extra padding fix --- ungleich_page/static/ungleich_page/css/agency.css | 13 ++++++++++++- .../templates/ungleich_page/glasfaser.html | 11 +++++------ .../glasfaser/section_text_glasfaser.html | 3 +-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ungleich_page/static/ungleich_page/css/agency.css b/ungleich_page/static/ungleich_page/css/agency.css index 43a05898..011781e3 100755 --- a/ungleich_page/static/ungleich_page/css/agency.css +++ b/ungleich_page/static/ungleich_page/css/agency.css @@ -280,7 +280,7 @@ fieldset[disabled] .btn-xl.active { } .navbar-default .navbar-brand { - padding: 4px 8px 12px; + padding: 8px 8px; } .navbar-default.navbar-shrink .navbar-brand { padding: 6px 8px 10px; @@ -345,6 +345,7 @@ header .intro-text .intro-heading { section { padding: 75px 0; + border-bottom: 1px solid #f3f4f5; } @media(max-width:767px) { @@ -353,6 +354,16 @@ section { } } +section .section-heading-contain { + margin-bottom: 50px; +} + +@media(min-width:767px) { + section .section-heading-contain { + margin-bottom: 75px; + } +} + section h2.section-heading { margin-top: 0; margin-bottom: 15px; diff --git a/ungleich_page/templates/ungleich_page/glasfaser.html b/ungleich_page/templates/ungleich_page/glasfaser.html index 3d8fbb76..77338ac9 100644 --- a/ungleich_page/templates/ungleich_page/glasfaser.html +++ b/ungleich_page/templates/ungleich_page/glasfaser.html @@ -83,7 +83,7 @@ -
+
@@ -96,13 +96,12 @@
-
+
-
+

Was ist es?

-

Bei diesem Angebot handelt es sich um einen Internetzugang für Firmenkunden.

@@ -114,7 +113,7 @@
-
+

Technische Details

Im Angebot enthalten sind

@@ -156,7 +155,7 @@
-
+

Wie funktioniert es?

So kommen Sie in wenigen einfachen Schritten zu Ihrem High-Speed-Internet

diff --git a/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html b/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html index d3d83dfc..06b0e26d 100644 --- a/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html +++ b/ungleich_page/templates/ungleich_page/glasfaser/section_text_glasfaser.html @@ -1,9 +1,8 @@
-
+

{{instance.title}}

-

{{instance.description}}

From 3ef2aa4bfbd007721845c679cd572d717d0da28d Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 5 Jan 2018 18:31:24 +0530 Subject: [PATCH 038/162] removed unused header plugins --- ungleich_page/cms_plugins.py | 70 +------------------ .../migrations/0018_auto_20180105_1826.py | 64 +++++++++++++++++ ungleich_page/models.py | 53 -------------- 3 files changed, 67 insertions(+), 120 deletions(-) create mode 100644 ungleich_page/migrations/0018_auto_20180105_1826.py diff --git a/ungleich_page/cms_plugins.py b/ungleich_page/cms_plugins.py index fb40ea2b..47f296aa 100644 --- a/ungleich_page/cms_plugins.py +++ b/ungleich_page/cms_plugins.py @@ -3,11 +3,10 @@ from cms.plugin_pool import plugin_pool from .models import ( UngelichContactUsSection, UngelichTextSection, Service, ServiceItem, - About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader, - UngleichHeaderItem, UngleichProductItem, UngleichProduct, UngleichCustomer, - UngleichCustomerItem, UngleichHTMLOnly, UngleichSimpleHeader, + About, AboutItem, SectionWithImage, UngleichServiceItem, + UngleichProductItem, UngleichProduct, UngleichCustomer, + UngleichCustomerItem, UngleichHTMLOnly, UngleichHeaderWithBackgroundImageSlider, - UngleichHeaderWithBackgroundImageSliderItem, UngleichHeaderWithBackgroundVideoSliderItem, ) @@ -184,49 +183,6 @@ class UngleichServicesItemPlugin(CMSPluginBase): return context -@plugin_pool.register_plugin -class UngleichHeaderWithTextAndImagePlugin(CMSPluginBase): - name = "ungleich Header with Text and Image Plugin" - model = UngleichSimpleHeader - render_template = "ungleich_page/ungleich/header.html" - cache = False - - def render(self, context, instance, placeholder): - context['instance'] = instance - return context - - -@plugin_pool.register_plugin -class UngleichHeaderWithTextAndImageSliderPlugin(CMSPluginBase): - name = "ungleich Header with Text and Image Slider Plugin" - model = UngleichHeader - render_template = "ungleich_page/ungleich/header_with_slider.html" - cache = False - allow_children = True - child_classes = ['UngleichHeaderItemPlugin'] - - def render(self, context, instance, placeholder): - context['instance'] = instance - return context - - -@plugin_pool.register_plugin -class UngleichHeaderItemPlugin(CMSPluginBase): - name = "ungleich Header Item Plugin" - model = UngleichHeaderItem - render_template = "ungleich_page/ungleich/_header_item.html" - cache = False - require_parent = True - parent_classes = ['UngleichHeaderWithTextAndImageSliderPlugin'] - - def render(self, context, instance, placeholder): - context = super(UngleichHeaderItemPlugin, self).render( - context, instance, placeholder - ) - context['instance'] = instance - return context - - @plugin_pool.register_plugin class UngleichHeaderBackgroundImageAndTextSliderPlugin(CMSPluginBase): name = "ungleich Header with Background and Image Slider Plugin" @@ -237,7 +193,6 @@ class UngleichHeaderBackgroundImageAndTextSliderPlugin(CMSPluginBase): cache = False allow_children = True child_classes = [ - 'UngleichHeaderBackgroundImageAndTextItemPlugin', 'UngleichHeaderBackgroundVideoItemPlugin', ] @@ -263,25 +218,6 @@ class UngleichHeaderBackgroundVideoItemPlugin(CMSPluginBase): return context -@plugin_pool.register_plugin -class UngleichHeaderBackgroundImageAndTextItemPlugin(CMSPluginBase): - name = "ungleich Header with Background and Image and Text Item Plugin" - model = UngleichHeaderWithBackgroundImageSliderItem - render_template = ( - 'ungleich_page/ungleich/_header_with_background_image_slider_item.html' - ) - cache = False - require_parent = True - parent_classes = ['UngleichHeaderBackgroundImageAndTextSliderPlugin'] - - def render(self, context, instance, placeholder): - context = super( - UngleichHeaderBackgroundImageAndTextItemPlugin, self - ).render(context, instance, placeholder) - context['instance'] = instance - return context - - @plugin_pool.register_plugin class UngleichProductsPlugin(CMSPluginBase): name = "ungleich Products Plugin" diff --git a/ungleich_page/migrations/0018_auto_20180105_1826.py b/ungleich_page/migrations/0018_auto_20180105_1826.py new file mode 100644 index 00000000..b269fb04 --- /dev/null +++ b/ungleich_page/migrations/0018_auto_20180105_1826.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-01-05 12:56 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '0014_auto_20160404_1908'), + ('ungleich_page', '0017_auto_20171219_1856'), + ] + + operations = [ + migrations.RemoveField( + model_name='ungleichheader', + name='background_image', + ), + migrations.RemoveField( + model_name='ungleichheader', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichheaderitem', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichheaderitem', + name='image', + ), + migrations.RemoveField( + model_name='ungleichheaderwithbackgroundimageslideritem', + name='background_image', + ), + migrations.RemoveField( + model_name='ungleichheaderwithbackgroundimageslideritem', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichsimpleheader', + name='background_image', + ), + migrations.RemoveField( + model_name='ungleichsimpleheader', + name='cmsplugin_ptr', + ), + migrations.RemoveField( + model_name='ungleichsimpleheader', + name='image', + ), + migrations.DeleteModel( + name='UngleichHeader', + ), + migrations.DeleteModel( + name='UngleichHeaderItem', + ), + migrations.DeleteModel( + name='UngleichHeaderWithBackgroundImageSliderItem', + ), + migrations.DeleteModel( + name='UngleichSimpleHeader', + ), + ] diff --git a/ungleich_page/models.py b/ungleich_page/models.py index ad44c161..b96afcb1 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -98,63 +98,10 @@ class UngleichServiceItem(ServiceItem): ) -class UngleichSimpleHeader(CMSPlugin): - background_image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_simple_header_background_image", - on_delete=models.SET_NULL - ) - image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_simple_header_image", - on_delete=models.SET_NULL - ) - text = HTMLField() - - -class UngleichHeader(CMSPlugin): - background_image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_header_background_image", - on_delete=models.SET_NULL - ) - carousel_data_interval = models.IntegerField(default=5000) - - -class UngleichHeaderWithBackgroundImageSliderItem(CMSPlugin): - background_image = FilerImageField( - null=True, blank=True, - related_name="ungleich_header_slider_item_image", - on_delete=models.SET_NULL - ) - description = HTMLField( - default='
We Design, Configure & Maintain ' - '
Your Linux Infrastructure

' - 'Ruby on Rails, Django, Java, Webserver, Mailserver, any ' - 'infrastructure that needs to configured, we provide ' - 'comprehensive solutions. Amazon, rackspace or bare metal ' - 'servers, we configure for you.

Learn More

' - ) - - class UngleichHeaderWithBackgroundImageSlider(CMSPlugin): carousel_data_interval = models.IntegerField(default=2000) -class UngleichHeaderItem(CMSPlugin): - image = FilerImageField( - null=True, - blank=True, - related_name="ungleich_header_item_image", - on_delete=models.SET_NULL - ) - description = HTMLField() - - class UngleichHeaderWithBackgroundVideoSliderItem(CMSPlugin): image = FilerImageField( null=True, From 6dd69b24fa41cb276fca6be99f28e2ac1816be35 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 7 Jan 2018 08:42:52 +0100 Subject: [PATCH 039/162] Replace another occurrence in a commented block --- nosystemd/templates/nosystemd/landing.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nosystemd/templates/nosystemd/landing.html b/nosystemd/templates/nosystemd/landing.html index 9836e86c..2e19af2f 100755 --- a/nosystemd/templates/nosystemd/landing.html +++ b/nosystemd/templates/nosystemd/landing.html @@ -96,7 +96,7 @@
From aff4288cd99c6f5215559c606a4632d81e6dc71a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 7 Jan 2018 09:29:54 +0100 Subject: [PATCH 040/162] Update Changelog --- Changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog b/Changelog index 4a9945f9..010e094f 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +Next: + * #4000: [all] Replace all ungleich.com with ungleich.ch 1.3.1: 2017-12-31 * feature: [all] Load email configurations host, port and use_tls from env * bugfix: [all] Use ungleich's smtp as relayhost for sending emails From 205274be42c72b60e2ea8f5f50f29a05383c7418 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Sun, 7 Jan 2018 20:40:38 +0530 Subject: [PATCH 041/162] removed ununsed templates --- .../ungleich_page/ungleich/_header_item.html | 14 ------------- ...der_with_background_image_slider_item.html | 4 ---- .../ungleich_page/ungleich/header.html | 15 ------------- .../ungleich/header_with_slider.html | 21 ------------------- 4 files changed, 54 deletions(-) delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/_header_item.html delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/header.html delete mode 100644 ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html diff --git a/ungleich_page/templates/ungleich_page/ungleich/_header_item.html b/ungleich_page/templates/ungleich_page/ungleich/_header_item.html deleted file mode 100644 index a770d1ed..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/_header_item.html +++ /dev/null @@ -1,14 +0,0 @@ -
-
- {% if instance.image %} - -
- {% endif %} -
- - {{ instance.description }} - -
-
-
diff --git a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html b/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html deleted file mode 100644 index 063a0a7b..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_image_slider_item.html +++ /dev/null @@ -1,4 +0,0 @@ -
-
- {{ instance.description }} -
\ No newline at end of file diff --git a/ungleich_page/templates/ungleich_page/ungleich/header.html b/ungleich_page/templates/ungleich_page/ungleich/header.html deleted file mode 100644 index 77c7ffdf..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/header.html +++ /dev/null @@ -1,15 +0,0 @@ -{% load cms_tags %} - -
-
-
- -


-
- - {{ instance.text }} - -
-
-
-
diff --git a/ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html b/ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html deleted file mode 100644 index 9cf759e6..00000000 --- a/ungleich_page/templates/ungleich_page/ungleich/header_with_slider.html +++ /dev/null @@ -1,21 +0,0 @@ -{% load cms_tags %} -
- -
\ No newline at end of file From 157cc5ac5d7161f5ff4442aa6936dae237988678 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 00:56:54 +0530 Subject: [PATCH 042/162] fix datacenterlight templates --- .../datacenterlight/base_hosting.html | 117 ++++++++++++++++++ .../emails/base_email_datacenterlight.html | 2 + .../_calculator_form.html} | 0 .../templates/datacenterlight/index.html | 2 +- .../datacenterlight/landing_payment.html | 2 +- .../datacenterlight/order_detail.html | 2 +- .../datacenterlight/whydatacenterlight.html | 2 +- datacenterlight/urls.py | 4 +- datacenterlight/views.py | 2 + 9 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 datacenterlight/templates/datacenterlight/base_hosting.html rename datacenterlight/templates/datacenterlight/{calculator_form.html => includes/_calculator_form.html} (100%) diff --git a/datacenterlight/templates/datacenterlight/base_hosting.html b/datacenterlight/templates/datacenterlight/base_hosting.html new file mode 100644 index 00000000..613d67a9 --- /dev/null +++ b/datacenterlight/templates/datacenterlight/base_hosting.html @@ -0,0 +1,117 @@ +{% load staticfiles bootstrap3%} +{% load i18n %} + + + + + + + + + + + + ungleich + + + + + + + + + + + + + + + {% block css_extra %} + {% endblock css_extra %} + + + + + + + + + + + + + {% include "google_analytics.html" %} + + + + + + + {% block navbar %} + {% include "hosting/includes/_navbar_user.html" %} + {% endblock navbar %} + +
+ {% block content %} + {% endblock %} +
+ + + {% if request.user.is_authenticated %} +
+
+ +
+
+ {% else %} + + {% endif %} + + + + + + + + + + + + + + + + + + + + + {% block js_extra %} + {% comment %} + this block is above some files, because on stripe error scripts below the stripe + script are not properly executed. + {% endcomment %} + {% endblock js_extra %} + + + + + + + + + + + + + + + + + + diff --git a/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html b/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html index be8479d9..3f06b069 100644 --- a/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html +++ b/datacenterlight/templates/datacenterlight/emails/base_email_datacenterlight.html @@ -1,5 +1,7 @@ {% load static from staticfiles %} {% load i18n %} +{% comment %} unused {% endcomment %} +
- {% include "datacenterlight/calculator_form.html" %} + {% include "datacenterlight/includes/_calculator_form.html" %}
diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index f2f75e9c..8e779576 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -1,4 +1,4 @@ -{% extends "hosting/base_short.html" %} +{% extends "datacenterlight/base_hosting.html" %} {% load staticfiles bootstrap3 i18n %} {% block css_extra %} diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index ec4befc9..79119777 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -1,4 +1,4 @@ -{% extends "hosting/order_detail.html" %} +{% extends "datacenterlight/base_hosting.html" %} {% load i18n %} {% block navbar %} diff --git a/datacenterlight/templates/datacenterlight/whydatacenterlight.html b/datacenterlight/templates/datacenterlight/whydatacenterlight.html index c54156b6..ee6cfefa 100644 --- a/datacenterlight/templates/datacenterlight/whydatacenterlight.html +++ b/datacenterlight/templates/datacenterlight/whydatacenterlight.html @@ -137,7 +137,7 @@
- {% include "datacenterlight/calculator_form.html" %} + {% include "datacenterlight/includes/_calculator_form.html" %}
diff --git a/datacenterlight/urls.py b/datacenterlight/urls.py index 2cd0723f..8d6273ef 100644 --- a/datacenterlight/urls.py +++ b/datacenterlight/urls.py @@ -17,8 +17,8 @@ urlpatterns = [ url(r'^l/$', IndexView.as_view(), name='index_l'), url(r'^whydatacenterlight/?$', WhyDataCenterLightView.as_view(), name='whydatacenterlight'), - url(r'^beta-program/?$', BetaProgramView.as_view(), name='beta'), - url(r'^landing/?$', LandingProgramView.as_view(), name='landing'), + # url(r'^beta-program/?$', BetaProgramView.as_view(), name='beta'), + # url(r'^landing/?$', LandingProgramView.as_view(), name='landing'), url(r'^payment/?$', PaymentOrderView.as_view(), name='payment'), url(r'^order-confirmation/?$', OrderConfirmationView.as_view(), name='order_confirmation'), diff --git a/datacenterlight/views.py b/datacenterlight/views.py index fda8c9c9..8a41005f 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -76,6 +76,7 @@ class ContactUsView(FormView): class LandingProgramView(TemplateView): + # FIXME: template doesn't exist template_name = "datacenterlight/landing.html" @@ -143,6 +144,7 @@ class BetaAccessView(FormView): class BetaProgramView(CreateView): + # FIXME: template doesn't exist template_name = "datacenterlight/beta.html" model = BetaAccessVM fields = '__all__' From 24bd5a18809fe1348f4243035cc4b5602c7e6dae Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 02:33:04 +0530 Subject: [PATCH 043/162] navbar closes on click, smooth scroll enabled --- .../static/ungleich_page/js/ungleich.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ungleich_page/static/ungleich_page/js/ungleich.js b/ungleich_page/static/ungleich_page/js/ungleich.js index ca6a71e3..d2121bcb 100644 --- a/ungleich_page/static/ungleich_page/js/ungleich.js +++ b/ungleich_page/static/ungleich_page/js/ungleich.js @@ -15,3 +15,30 @@ function toggleImage(e) { $this.fadeIn(300); }); }; + +/*! + * Start Bootstrap - Agnecy Bootstrap Theme (http://startbootstrap.com) + * Code licensed under the Apache License v2.0. + * For details, see http://www.apache.org/licenses/LICENSE-2.0. + */ + +// jQuery for page scrolling feature - requires jQuery Easing plugin +$(function() { + $('a.page-scroll').bind('click', function(event) { + var $anchor = $(this); + $('html, body').stop().animate({ + scrollTop: $($anchor.attr('href')).offset().top + }, 1500, 'easeInOutExpo'); + event.preventDefault(); + }); +}); + +// Highlight the top nav as scrolling occurs +$('body').scrollspy({ + target: '.navbar-fixed-top' +}) + +// Closes the Responsive Menu on Menu Item Click +$('.navbar-collapse ul li a').click(function() { + $('.navbar-toggle:visible').click(); +}); From 12fe1fa7226cc5a6967bd6e77057b3da6da1606a Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 02:45:16 +0530 Subject: [PATCH 044/162] Update Changelog --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index 010e094f..7e681a75 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ Next: * #4000: [all] Replace all ungleich.com with ungleich.ch + * #4067: [ungleich] mobile navbar toggle fix 1.3.1: 2017-12-31 * feature: [all] Load email configurations host, port and use_tls from env * bugfix: [all] Use ungleich's smtp as relayhost for sending emails From 0697492ab8cc2912adbf2fbf7c82855cda988ade Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Mon, 8 Jan 2018 07:36:30 +0530 Subject: [PATCH 045/162] removed unused css files --- datacenterlight/templates/datacenterlight/base_hosting.html | 3 --- datacenterlight/templates/datacenterlight/beta_success.html | 1 - dynamicweb/settings/base.py | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/base_hosting.html b/datacenterlight/templates/datacenterlight/base_hosting.html index 613d67a9..848b8a46 100644 --- a/datacenterlight/templates/datacenterlight/base_hosting.html +++ b/datacenterlight/templates/datacenterlight/base_hosting.html @@ -21,10 +21,8 @@ - - {% block css_extra %} {% endblock css_extra %} @@ -49,7 +47,6 @@ - {% block navbar %} {% include "hosting/includes/_navbar_user.html" %} {% endblock navbar %} diff --git a/datacenterlight/templates/datacenterlight/beta_success.html b/datacenterlight/templates/datacenterlight/beta_success.html index 60df607c..7ac49457 100644 --- a/datacenterlight/templates/datacenterlight/beta_success.html +++ b/datacenterlight/templates/datacenterlight/beta_success.html @@ -1,4 +1,3 @@ - {% load i18n %} -
+ {% csrf_token %}
+
{{contact_form.name.errors}}
@@ -30,6 +31,7 @@
+
{{contact_form.email.errors}}
@@ -37,6 +39,7 @@
+
{{contact_form.message.errors}}
diff --git a/datacenterlight/templates/datacenterlight/includes/_navbar.html b/datacenterlight/templates/datacenterlight/includes/_navbar.html index e2f1edc0..2f435704 100644 --- a/datacenterlight/templates/datacenterlight/includes/_navbar.html +++ b/datacenterlight/templates/datacenterlight/includes/_navbar.html @@ -1,6 +1,6 @@ -{% load staticfiles i18n%} -{% load custom_tags %} +{% load staticfiles i18n custom_tags %} {% get_current_language as LANGUAGE_CODE %} +
diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 8a41005f..0e860b7e 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -391,7 +391,6 @@ class PaymentOrderView(FormView): @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): - # user is no longer added to session on the index page if 'specs' not in request.session: return HttpResponseRedirect(reverse('datacenterlight:index')) return self.render_to_response(self.get_context_data()) diff --git a/digitalglarus/templates/new_base_glarus.html b/digitalglarus/templates/new_base_glarus.html index 3b18756d..9a24f269 100644 --- a/digitalglarus/templates/new_base_glarus.html +++ b/digitalglarus/templates/new_base_glarus.html @@ -72,8 +72,8 @@ margin: 0px; color:white; } - - @media only screen and (min-width: 769px){ + + @media only screen and (min-width: 769px){ .dropdown.home-dropdown-mobile { display: none; } @@ -81,14 +81,14 @@ display: block; } } - - + + @media only screen and (max-width: 768px){ .dropdown.home-dropdown-mobile { display: block; - background-color: + background-color: } - + .dropdown.home-dropdown-mobile .dropdown-menu{ display: block; background-color: #0f1221; @@ -104,19 +104,19 @@ .dropdown.home-dropdown { display: none; } - + } - + - +