|
|
|
@ -31,10 +31,10 @@ def add_children_hierarchy(instance, models_dict): |
|
|
|
relationships = sync_models[instance.__class__.__name__] |
|
|
|
relationships = sync_models[instance.__class__.__name__] |
|
|
|
# 'Match': {'team_scores', 'team_registration', 'player_registrations'} |
|
|
|
# 'Match': {'team_scores', 'team_registration', 'player_registrations'} |
|
|
|
|
|
|
|
|
|
|
|
# print(f'relationships = {relationships}') |
|
|
|
print(f'relationships = {relationships}') |
|
|
|
current = [instance] |
|
|
|
current = [instance] |
|
|
|
for relationship in relationships: |
|
|
|
for relationship in relationships: |
|
|
|
# print(f'relationship = {relationship}') |
|
|
|
print(f'> relationship = {relationship}') |
|
|
|
values = [] |
|
|
|
values = [] |
|
|
|
for item in current: |
|
|
|
for item in current: |
|
|
|
value = getattr(item, relationship) |
|
|
|
value = getattr(item, relationship) |
|
|
|
@ -353,20 +353,20 @@ class LogProcessingResult: |
|
|
|
revocations = defaultdict(list) |
|
|
|
revocations = defaultdict(list) |
|
|
|
revocations_parents_organizer = HierarchyOrganizer() |
|
|
|
revocations_parents_organizer = HierarchyOrganizer() |
|
|
|
|
|
|
|
|
|
|
|
print(f'*** process_revocations: {len(self.revoke_info)}') |
|
|
|
# print(f'*** process_revocations: {len(self.revoke_info)}') |
|
|
|
|
|
|
|
|
|
|
|
# First, collect all revocations |
|
|
|
# First, collect all revocations |
|
|
|
for model_name, items in self.revoke_info.items(): |
|
|
|
for model_name, items in self.revoke_info.items(): |
|
|
|
revocations[model_name].extend(items) |
|
|
|
revocations[model_name].extend(items) |
|
|
|
|
|
|
|
|
|
|
|
print(f'*** process_revocations for {model_name}') |
|
|
|
# print(f'*** process_revocations for {model_name}') |
|
|
|
|
|
|
|
|
|
|
|
# Process parent hierarchies for each revoked item |
|
|
|
# Process parent hierarchies for each revoked item |
|
|
|
model = model_registry.get_model(model_name) |
|
|
|
model = model_registry.get_model(model_name) |
|
|
|
for item in items: |
|
|
|
for item in items: |
|
|
|
try: |
|
|
|
try: |
|
|
|
instance = model.objects.get(id=item['model_id']) |
|
|
|
instance = model.objects.get(id=item['model_id']) |
|
|
|
print(f'*** process revoked item parents of {model_name} : {item['model_id']}') |
|
|
|
# print(f'*** process revoked item parents of {model_name} : {item['model_id']}') |
|
|
|
add_parents_with_hierarchy_organizer(instance, revocations_parents_organizer) |
|
|
|
add_parents_with_hierarchy_organizer(instance, revocations_parents_organizer) |
|
|
|
except model.DoesNotExist: |
|
|
|
except model.DoesNotExist: |
|
|
|
pass |
|
|
|
pass |
|
|
|
|