Skip to content

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

Add product updated_add field

Artur Smęta75a87926cdd
diff --git a/saleor/product/migrations/0006_product_updated_at.py b/saleor/product/migrations/0006_product_updated_at.py
new file mode 100644
index 0000000000..63f014b0a2
--- /dev/null
+++ b/saleor/product/migrations/0006_product_updated_at.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('product', '0005_auto_20150825_1433'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='product',
+ name='updated_at',
+ field=models.DateTimeField(auto_now=True, verbose_name='updated at', null=True),
+ ),
+ ]
diff --git a/saleor/product/models/base.py b/saleor/product/models/base.py
index 91857efa1d..bc5795065c 100644
--- a/saleor/product/models/base.py
+++ b/saleor/product/models/base.py
@@ -89,6 +89,8 @@ class Product(models.Model, ItemRange):
pgettext_lazy('Product field', 'available on'), blank=True, null=True)
attributes = models.ManyToManyField(
'ProductAttribute', related_name='products', blank=True)
+ updated_at = models.DateTimeField(
+ pgettext_lazy('Product field', 'updated at'), auto_now=True, null=True)
objects = ProductManager()