handle res metadata corruption with a check
Revert "[#4695] account for res with corrupted metadata"
This partially reverts commit
@@ -8,7 +8,6 @@ Related to https://github.com/hydroshare/hydroshare/issues/4695
from django.core.management.base import BaseCommand
from hs_core.models import BaseResource
-from hs_core.models import Creator
from hs_core.hydroshare.utils import set_dirty_bag_flag
@@ -18,7 +17,8 @@ class Command(BaseCommand):
def handle(self, *args, **options):
resources = BaseResource.objects.filter(raccess__published=False).only('object_id', 'short_id')
for res in resources:
- creators = Creator.objects.filter(object_id=res.object_id)
+ if res.metadata is not None:
+ creators = res.metadata.creators.all()
is_dirty = False
for index, creator in enumerate(creators, start=1):
if creator.order != index:
