From 7b8301f143a8b87088bcd6eaa219343057b9886b Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 10 Aug 2018 21:16:53 +0200 Subject: [PATCH 1/9] Send email to admin on dg subscriptionon dg subscription --- digitalglarus/views.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index f99577c5..299327e6 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -492,6 +492,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): 'membership_dates': membership.type.first_month_formated_range }) + email_to_admin_data = { + 'subject': "New Digital Glarus subscription: {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 + order_data.items()]), + } + send_plain_email_task.delay(email_to_admin_data) + context = { 'membership': membership, 'order': membership_order, From f9584b4c829a47586366d1f541cb87dfd896eff5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 09:06:31 +0200 Subject: [PATCH 2/9] Fix a bug when vm_template is None --- hosting/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hosting/models.py b/hosting/models.py index e9fcdc7e..601568c5 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -53,9 +53,11 @@ class OrderDetail(AssignPermissionsMixin, models.Model): ssd_size = models.IntegerField(default=0) def __str__(self): - return "%s - %s, %s cores, %s GB RAM, %s GB SSD" % ( - self.vm_template.name, self.vm_template.vm_type, self.cores, - self.memory, self.ssd_size + return "Not available" if self.vm_template is None else ( + "%s - %s, %s cores, %s GB RAM, %s GB SSD" % ( + self.vm_template.name, self.vm_template.vm_type, self.cores, + self.memory, self.ssd_size + ) ) From 4a1434c514db700a5b7e25d733429ba5f9abc86a Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 09:07:07 +0200 Subject: [PATCH 3/9] Make string representation of HostingOrder more readable --- hosting/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hosting/models.py b/hosting/models.py index 601568c5..c4de453f 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -89,7 +89,9 @@ class HostingOrder(AssignPermissionsMixin, models.Model): ) def __str__(self): - return "%s" % (self.id) + return "Order Nr: #{} - VM_ID: {} - {} - {}".format( + self.id, self.vm_id, self.customer.user.email, self.created_at + ) @cached_property def status(self): From 4baa3a709543bc72fd00741a27315b1db9004488 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 09:18:55 +0200 Subject: [PATCH 4/9] Improve HostingOrder str representation --- hosting/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hosting/models.py b/hosting/models.py index c4de453f..abc4c428 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -89,8 +89,10 @@ class HostingOrder(AssignPermissionsMixin, models.Model): ) def __str__(self): - return "Order Nr: #{} - VM_ID: {} - {} - {}".format( - self.id, self.vm_id, self.customer.user.email, self.created_at + return ("Order Nr: #{} - VM_ID: {} - {} - {} - " + "Specs: {} - Price: {}").format( + self.id, self.vm_id, self.customer.user.email, self.created_at, + self.order_detail, self.price ) @cached_property From feceb14aec336fc3da459352c8271dda66e10612 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 23 Aug 2018 19:55:30 +0200 Subject: [PATCH 5/9] Update Changelog --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index e76db610..2ebefaa3 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ Next: + * #5458: [admin] Make hostingorder more readable (PR #657) * bugfix: [CMS templates] Set description meta field of ungleich template (was missing before) and set ungleich glarus ag uniformly as author of various CMS pages (PR #653) * #5473: Ping a VM before saving ssh key of the user (PR #655) 2.1: 2018-08-21 From a45eef04093072a7ff78d39120678f7cab381fd8 Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 24 Aug 2018 09:37:56 +0200 Subject: [PATCH 6/9] Change cc_brand field to 128 chars --- digitalglarus/mixins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/digitalglarus/mixins.py b/digitalglarus/mixins.py index 7c214e14..18a02239 100644 --- a/digitalglarus/mixins.py +++ b/digitalglarus/mixins.py @@ -39,7 +39,7 @@ class Ordereable(models.Model): created_at = models.DateTimeField(auto_now_add=True) approved = models.BooleanField(default=False) last4 = models.CharField(max_length=4, blank=True) - cc_brand = models.CharField(max_length=10, blank=True) + cc_brand = models.CharField(max_length=128, blank=True) stripe_charge_id = models.CharField(max_length=100, null=True) class Meta: From c458b56f71ed94abadcb0f7e0a3ab86b3669fe1f Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 24 Aug 2018 09:40:15 +0200 Subject: [PATCH 7/9] Add migration file --- .../migrations/0026_auto_20180824_0739.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 digitalglarus/migrations/0026_auto_20180824_0739.py diff --git a/digitalglarus/migrations/0026_auto_20180824_0739.py b/digitalglarus/migrations/0026_auto_20180824_0739.py new file mode 100644 index 00000000..6ebad14f --- /dev/null +++ b/digitalglarus/migrations/0026_auto_20180824_0739.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-08-24 07:39 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('digitalglarus', '0025_membershiporder_stripe_subscription_id'), + ] + + operations = [ + migrations.AlterField( + model_name='bookingorder', + name='cc_brand', + field=models.CharField(blank=True, max_length=128), + ), + migrations.AlterField( + model_name='membershiporder', + name='cc_brand', + field=models.CharField(blank=True, max_length=128), + ), + ] From 4a16251a6981374dfaa931fc7504fdfc43ee49cb Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 24 Aug 2018 10:00:17 +0200 Subject: [PATCH 8/9] Update Changelog --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index 2ebefaa3..b98529ab 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ Next: + * bugfix: [dg] Send email to admin on dg subscription (PR #652) * #5458: [admin] Make hostingorder more readable (PR #657) * bugfix: [CMS templates] Set description meta field of ungleich template (was missing before) and set ungleich glarus ag uniformly as author of various CMS pages (PR #653) * #5473: Ping a VM before saving ssh key of the user (PR #655) From 9a5b9c7af5d539f1f12f9db726cb1320c78f03eb Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 24 Aug 2018 10:05:37 +0200 Subject: [PATCH 9/9] Update Changelog --- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index b98529ab..538a862d 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,5 @@ Next: - * bugfix: [dg] Send email to admin on dg subscription (PR #652) + * bugfix: [dg] Send email to admin on dg subscription and increase cc_brand field to 128 characters (PR #652) * #5458: [admin] Make hostingorder more readable (PR #657) * bugfix: [CMS templates] Set description meta field of ungleich template (was missing before) and set ungleich glarus ag uniformly as author of various CMS pages (PR #653) * #5473: Ping a VM before saving ssh key of the user (PR #655)