Skip to content

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

Add default ordering for Address models

Marcin Gębalae1d5ec00d3f4
diff --git a/saleor/account/migrations/0025_auto_20190314_0550.py b/saleor/account/migrations/0025_auto_20190314_0550.py
new file mode 100644
index 0000000000..a879faab7b
--- /dev/null
+++ b/saleor/account/migrations/0025_auto_20190314_0550.py
@@ -0,0 +1,17 @@
+# Generated by Django 2.1.7 on 2019-03-14 10:50
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('account', '0024_auto_20181011_0737'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='address',
+ options={'ordering': ('pk',)},
+ ),
+ ]
diff --git a/saleor/account/models.py b/saleor/account/models.py
index 2364c5176f..34fb315a95 100644
--- a/saleor/account/models.py
+++ b/saleor/account/models.py
@@ -52,6 +52,9 @@ class Address(models.Model):
objects = AddressQueryset.as_manager()
+ class Meta:
+ ordering = ('pk', )
+
@property
def full_name(self):
return '%s %s' % (self.first_name, self.last_name)
@@ -61,16 +64,6 @@ class Address(models.Model):
return '%s - %s' % (self.company_name, self.full_name)
return self.full_name
- def __repr__(self):
- return (
- 'Address(first_name=%r, last_name=%r, company_name=%r, '
- 'street_address_1=%r, street_address_2=%r, city=%r, '
- 'postal_code=%r, country=%r, country_area=%r, phone=%r)' % (
- self.first_name, self.last_name, self.company_name,
- self.street_address_1, self.street_address_2, self.city,
- self.postal_code, self.country, self.country_area,
- self.phone))
-
def __eq__(self, other):
return self.as_data() == other.as_data()