<commit_before>from promrep.models import Group, PostAssertion
from django.db.models.signals import post_delete

def delete_parent_group(sender, instance, *args, **kwargs):
    """
    deletes the group associated with a post assertion if
    that post only has that post assertion
    """

    if instance.group.postassertion_set.count() == 0:
        instance.group.delete()

post_delete.connect(delete_parent_group, sender=PostAssertion)<commit_msg>fixes bug that was preventing some persons/postassertions to be deleted (DPRR-143).<commit_after>from promrep.models import Group, PostAssertion
from django.db.models.signals import post_delete

def delete_parent_group(sender, instance, *args, **kwargs):
    """
    deletes the group associated with a post assertion if
    that post only has that post assertion
    """

    if instance.group:
        if instance.group.postassertion_set.count() == 0:
            instance.group.delete()

post_delete.connect(delete_parent_group, sender=PostAssertion)
{'fraction_non_alphanumeric': 0.08656716417910448, 'fraction_numerical': 0.004975124378109453, 'mean_word_length': 4.379679144385027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2312583', 'n_tokens_mistral': 289, 'n_tokens_neox': 277, 'n_words': 83}