Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Adapt address model to i18n data model

Artur Smętb18aff704abb
diff --git a/saleor/userprofile/migrations/0007_auto_20161013_0633.py b/saleor/userprofile/migrations/0007_auto_20161013_0633.py
new file mode 100644
index 0000000000..9475833100
--- /dev/null
+++ b/saleor/userprofile/migrations/0007_auto_20161013_0633.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.1 on 2016-10-13 11:33
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('userprofile', '0006_auto_20160829_0819'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='address',
+ name='sorting_code',
+ field=models.CharField(blank=True, max_length=128, verbose_name='sorting code'),
+ ),
+ migrations.AlterField(
+ model_name='address',
+ name='first_name',
+ field=models.CharField(blank=True, max_length=256, verbose_name='first name'),
+ ),
+ migrations.AlterField(
+ model_name='address',
+ name='last_name',
+ field=models.CharField(blank=True, max_length=256, verbose_name='last name'),
+ ),
+ migrations.AlterField(
+ model_name='address',
+ name='street_address_1',
+ field=models.TextField(blank=True, verbose_name='address'),
+ ),
+ ]
diff --git a/saleor/userprofile/migrations/0008_auto_20161013_0901.py b/saleor/userprofile/migrations/0008_auto_20161013_0901.py
new file mode 100644
index 0000000000..779b83cb8a
--- /dev/null
+++ b/saleor/userprofile/migrations/0008_auto_20161013_0901.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.1 on 2016-10-13 14:01
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('userprofile', '0007_auto_20161013_0633'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='address',
+ old_name='street_address_1',
+ new_name='street_address',
+ ),
+ migrations.RemoveField(
+ model_name='address',
+ name='street_address_2',
+ ),
+ ]
diff --git a/saleor/userprofile/models.py b/saleor/userprofile/models.py
index 0b98b6afa1..939f8cb97d 100644
--- a/saleor/userprofile/models.py
+++ b/saleor/userprofile/models.py
@@ -33,19 +33,16 @@ class AddressManager(models.Manager):
class Address(models.Model):
first_name = models.CharField(
pgettext_lazy('Address field', 'first name'),
- max_length=256)
+ max_length=256, blank=True)
last_name = models.CharField(
pgettext_lazy('Address field', 'last name'),
- max_length=256)
+ max_length=256, blank=True)
company_name = models.CharField(
pgettext_lazy('Address field', 'company or organization'),
max_length=256, blank=True)
- street_address_1 = models.CharField(
+ street_address = models.TextField(
pgettext_lazy('Address field', 'address'),
- max_length=256, blank=True)
- street_address_2 = models.CharField(
- pgettext_lazy('Address field', 'address'),
- max_length=256, blank=True)
+ blank=True)
city = models.CharField(
pgettext_lazy('Address field', 'city'),
max_length=256, blank=True)
@@ -63,6 +60,10 @@ class Address(models.Model):
phone = models.CharField(
pgettext_lazy('Address field', 'phone number'),
max_length=30, blank=True)
+ sorting_code = models.CharField(
+ pgettext_lazy('Address field', 'sorting code'),
+ max_length=128, blank=True
+ )
objects = AddressManager()