Skip to content
Snippets Groups Projects
Verified Commit 9c91d140 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Simplify registering of data check results by adding a dedicated method

parent 4d3681c1
No related branches found
No related tags found
1 merge request!389Add data check system
Checking pipeline status
import logging
from django.contrib.contenttypes.models import ContentType
from django.db.models.aggregates import Count
from django.utils.translation import gettext as _
......@@ -44,6 +45,16 @@ class DataCheck:
with reversion.create_revision():
cls.solve_options[solve_option].solve(check_result)
@classmethod
def register_result(cls, instance) -> "DataCheckResult":
from aleksis.core.models import DataCheckResult
ct = ContentType.objects.get_for_model(instance)
result = DataCheckResult.objects.get_or_create(
check=cls.name, content_type=ct, object_id=instance.id
)
return result
class DataCheckRegistry:
def __init__(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment