Kaynağa Gözat

Change data migration to act on frozen orm model instead of using call_command

master
Moose 12 yıl önce
ebeveyn
işleme
0165ea7cbb

+ 2
- 2
oscar/apps/catalogue/migrations/0010_call_update_product_ratings.py Dosyayı Görüntüle

@@ -7,8 +7,8 @@ from django.db import models
7 7
 class Migration(DataMigration):
8 8
 
9 9
     def forwards(self, orm):
10
-        from django.core.management import call_command
11
-        call_command('oscar_update_product_ratings')
10
+        for product in orm['catalogue.Product'].objects.all():
11
+            product.update_rating()
12 12
 
13 13
     def backwards(self, orm):
14 14
         # rating field will be deleted anyway if migrating backwards

Loading…
İptal
Kaydet