Begin phasing in the uncloudprovider

This commit is contained in:
Nico Schottelius 2020-10-11 17:45:25 +02:00
parent e03cdf214a
commit fe4e200dc0
3 changed files with 29 additions and 2 deletions

View file

@ -73,7 +73,6 @@ python manage.py migrate
# Import VAT rates
python manage.py import-vat-rates
#+END_SRC
* Testing / CLI Access

View file

@ -0,0 +1,23 @@
# Generated by Django 3.1 on 2020-10-11 15:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0031_auto_20201006_1655'),
]
operations = [
migrations.CreateModel(
name='UncloudProvider',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('valid_from', models.DateField()),
('valid_to', models.DateField(blank=True)),
('billing_address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.billingaddress')),
],
),
]

View file

@ -1010,7 +1010,12 @@ class Order(models.Model):
def __str__(self):
return f"Order {self.id}: {self.description} {self.config}"
try:
conf = " ".join([ f"{key}:{val}" for key,val in self.config['features'].items() if val != 0 ])
except KeyError:
conf = ""
return f"Order {self.id}: {self.description} {conf}"
class Bill(models.Model):
"""