Merge branch 'master' into task/5487/warn_users_before_terminating_vm

This commit is contained in:
PCoder 2018-08-24 10:58:24 +02:00
commit 4f745b607d
5 changed files with 50 additions and 5 deletions

View file

@ -1,4 +1,6 @@
Next: Next:
* 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) * 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) * #5473: Ping a VM before saving ssh key of the user (PR #655)
2.1: 2018-08-21 2.1: 2018-08-21

View file

@ -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),
),
]

View file

@ -39,7 +39,7 @@ class Ordereable(models.Model):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
approved = models.BooleanField(default=False) approved = models.BooleanField(default=False)
last4 = models.CharField(max_length=4, blank=True) 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) stripe_charge_id = models.CharField(max_length=100, null=True)
class Meta: class Meta:

View file

@ -492,6 +492,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView):
'membership_dates': membership.type.first_month_formated_range '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 = { context = {
'membership': membership, 'membership': membership,
'order': membership_order, 'order': membership_order,

View file

@ -53,9 +53,11 @@ class OrderDetail(AssignPermissionsMixin, models.Model):
ssd_size = models.IntegerField(default=0) ssd_size = models.IntegerField(default=0)
def __str__(self): def __str__(self):
return "%s - %s, %s cores, %s GB RAM, %s GB SSD" % ( return "Not available" if self.vm_template is None else (
self.vm_template.name, self.vm_template.vm_type, self.cores, "%s - %s, %s cores, %s GB RAM, %s GB SSD" % (
self.memory, self.ssd_size self.vm_template.name, self.vm_template.vm_type, self.cores,
self.memory, self.ssd_size
)
) )
@ -87,7 +89,11 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
) )
def __str__(self): def __str__(self):
return "%s" % (self.id) 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 @cached_property
def status(self): def status(self):