Guard against the role field not being populated

when doing the final reset of Role.implicit_parents.
This commit is contained in:
Jeff Bradberry 2024-06-04 09:34:50 -04:00
parent 2c3a7fafc5
commit 345c1c11e9

View File

@ -180,6 +180,7 @@ print(" role_fields = [f for f in cls._meta.fields if isinstance(f, ImplicitR
print(" obj = cls.objects.get(id=obj_id)")
print(" for f in role_fields:")
print(" r = getattr(obj, f.name, None)")
print(" r.implicit_parents = '[]'")
print(" r.save()")
print(" if r is not None:")
print(" r.implicit_parents = '[]'")
print(" r.save()")
print(" obj.save()")