Bläddra i källkod

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

master
Moose 12 år sedan
förälder
incheckning
0165ea7cbb
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2
    2
      oscar/apps/catalogue/migrations/0010_call_update_product_ratings.py

+ 2
- 2
oscar/apps/catalogue/migrations/0010_call_update_product_ratings.py Visa fil

@@ -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

Laddar…
Avbryt
Spara