22 lines
613 B
Python
22 lines
613 B
Python
import json
|
|
import os.path
|
|
|
|
from django.core.management.base import BaseCommand
|
|
from django.conf import settings
|
|
|
|
from catalog.models import Item
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Update research field"
|
|
|
|
def handle(self, *args, **options):
|
|
qs = Item.objects.all()
|
|
for i in qs:
|
|
old = i.research
|
|
i.save()
|
|
i.refresh_from_db()
|
|
if old != i.research:
|
|
print("item {} research field went from {} to {}".format(i.id, old, i.research))
|
|
else:
|
|
print("item {} research field has not changed".format(i.id))
|