From ffcd7777b25dc777532f032c72dadeb34d58db21 Mon Sep 17 00:00:00 2001 From: pep-un Date: Mon, 13 Jan 2025 12:58:51 +1100 Subject: [PATCH] Delete q it a diff push by mistake on the git repo --- q | 421 -------------------------------------------------------------- 1 file changed, 421 deletions(-) delete mode 100644 q diff --git a/q b/q deleted file mode 100644 index 9b96974..0000000 --- a/q +++ /dev/null @@ -1,421 +0,0 @@ -diff --git a/conformity/admin.py b/conformity/admin.py -index 8196b68..27dad88 100644 ---- a/conformity/admin.py -+++ b/conformity/admin.py -@@ -5,7 +5,7 @@ Customize Django Admin Site to manage my Models instances - from django.contrib import admin - from import_export import resources - from import_export.admin import ImportExportModelAdmin --from .models import Organization, Policy, Measure, Conformity, Audit, Finding, Action, Control, ControlPoint -+from .models import Organization, Framework, Measure, Conformity, Audit, Finding, Action, Control, ControlPoint -  -  - class OrganizationResources(resources.ModelResource): -@@ -17,13 +17,13 @@ class OrganizationAdmin(ImportExportModelAdmin): - ressource_class = Organization -  -  --class PolicyResources(resources.ModelResource): -+class FrameworkResources(resources.ModelResource): - class Meta: -- model = Policy -+ model = Framework -  -  --class PolicyAdmin(ImportExportModelAdmin): -- ressource_class = Policy -+class FrameworkAdmin(ImportExportModelAdmin): -+ ressource_class = Framework -  -  - class MeasureResources(resources.ModelResource): -@@ -55,7 +55,7 @@ class ActionAdmin(ImportExportModelAdmin): -  -  - # Registration --admin.site.register(Policy, PolicyAdmin) -+admin.site.register(Framework, FrameworkAdmin) - admin.site.register(Measure, MeasureAdmin) - admin.site.register(Conformity, ConformityAdmin) - admin.site.register(Action, ActionAdmin) -diff --git a/conformity/migrations/0001_squashed_0014_mesure_is_parent.py b/conformity/migrations/0001_squashed_0014_mesure_is_parent.py -index f7c8759..ea1c41b 100644 ---- a/conformity/migrations/0001_squashed_0014_mesure_is_parent.py -+++ b/conformity/migrations/0001_squashed_0014_mesure_is_parent.py -@@ -47,7 +47,7 @@ class Migration(migrations.Migration): - ('name', models.CharField(max_length=256)), - ('administrative_id', models.CharField(blank=True, max_length=256)), - ('description', models.CharField(blank=True, max_length=256)), -- ('applicable_policies', models.ManyToManyField(blank=True, to='conformity.policy')), -+ ('applicable_frameworks', models.ManyToManyField(blank=True, to='conformity.policy')), - ], - ), - migrations.CreateModel( -diff --git a/conformity/migrations/0001_squashed_0029_alter_action_control_comment_and_more.py b/conformity/migrations/0001_squashed_0029_alter_action_control_comment_and_more.py -index 670c280..efe0eed 100644 ---- a/conformity/migrations/0001_squashed_0029_alter_action_control_comment_and_more.py -+++ b/conformity/migrations/0001_squashed_0029_alter_action_control_comment_and_more.py -@@ -40,7 +40,7 @@ class Migration(migrations.Migration): - ('name', models.CharField(max_length=256, unique=True)), - ('administrative_id', models.CharField(blank=True, max_length=256)), - ('description', models.TextField(blank=True, max_length=4096)), -- ('applicable_policies', models.ManyToManyField(blank=True, to='conformity.policy')), -+ ('applicable_frameworks', models.ManyToManyField(blank=True, to='conformity.policy')), - ], - options={ - 'ordering': ['name'], -diff --git a/conformity/migrations/0041_rename_policy_framework_alter_framework_options_and_more.py b/conformity/migrations/0041_rename_policy_framework_alter_framework_options_and_more.py -index 03d4015..067c37d 100644 ---- a/conformity/migrations/0041_rename_policy_framework_alter_framework_options_and_more.py -+++ b/conformity/migrations/0041_rename_policy_framework_alter_framework_options_and_more.py -@@ -23,4 +23,9 @@ class Migration(migrations.Migration): - old_name='policy', - new_name='framework', - ), -+ migrations.RenameField( -+ model_name='organization', -+ old_name='applicable_policies', -+ new_name='applicable_frameworks', -+ ), - ] -diff --git a/conformity/models.py b/conformity/models.py -index e255c84..7de3cb4 100644 ---- a/conformity/models.py -+++ b/conformity/models.py -@@ -1,6 +1,6 @@ - """ - Conformity module manage all the manual declarative aspect of conformity management. --It's Organized around Organization, Policy, Measure and Conformity classes. -+It's Organized around Organization, Framework, Measure and Conformity classes. - """ - from calendar import monthrange - from statistics import mean -@@ -20,19 +20,19 @@ from auditlog.context import set_actor - User = get_user_model() -  -  --class PolicyManager(models.Manager): -+class FrameworkManager(models.Manager): - def get_by_natural_key(self, name): - return self.get(name=name) -  -  --class Policy(models.Model): -+class Framework(models.Model): - """ -- Policy class represent the conformity policy you will apply on Organization. -- A Policy is simply a collections of Measure with publication parameter. -+ Framework class represent the conformity framework you will apply on Organization. -+ A Framework is simply a collections of Measure with publication parameter. - """ -  - class Type(models.TextChoices): -- """ List of the Type of policy """ -+ """ List of the Type of framework """ - INTERNATIONAL = 'INT', _('International Standard') - NATIONAL = 'NAT', _('National Standard') - TECHNICAL = 'TECH', _('Technical Standard') -@@ -40,7 +40,7 @@ class Policy(models.Model): - POLICY = 'POL', _('Internal Policy') - OTHER = 'OTHER', _('Other') -  -- objects = PolicyManager() -+ objects = FrameworkManager() - name = models.CharField(max_length=256, unique=True) - version = models.IntegerField(default=0) - publish_by = models.CharField(max_length=256) -@@ -62,35 +62,35 @@ class Policy(models.Model): - return (self.name) -  - def get_type(self): -- """return the readable version of the Policy Type""" -+ """return the readable version of the Framework Type""" - return self.Type(self.type).label -  - def get_measures(self): -- """return all Measure related to the Policy""" -- return Measure.objects.filter(policy=self.id) -+ """return all Measure related to the Framework""" -+ return Measure.objects.filter(framework=self.id) -  - def get_measures_number(self): -- """return the number of leaf Measure related to the Policy""" -- return Measure.objects.filter(policy=self.id).filter(measure__is_parent=False).count() -+ """return the number of leaf Measure related to the Framework""" -+ return Measure.objects.filter(framework=self.id).filter(measure__is_parent=False).count() -  - def get_root_measure(self): -- """return the root Measure of the Policy""" -- return Measure.objects.filter(policy=self.id).filter(level=0).order_by('order') -+ """return the root Measure of the Framework""" -+ return Measure.objects.filter(framework=self.id).filter(level=0).order_by('order') -  - def get_first_measures(self): -- """return the Measure of the first hierarchical level of the Policy""" -- return Measure.objects.filter(policy=self.id).filter(level=1).order_by('order') -+ """return the Measure of the first hierarchical level of the Framework""" -+ return Measure.objects.filter(framework=self.id).filter(level=1).order_by('order') -  -  - class Organization(models.Model): - """ - Organization class is a representation of a company, a division of company, an administration... -- The Organization may answer to one or several Policy. -+ The Organization may answer to one or several Framework. - """ - name = models.CharField(max_length=256, unique=True) - administrative_id = models.CharField(max_length=256, blank=True) - description = models.TextField(max_length=4096, blank=True) -- applicable_policies = models.ManyToManyField(Policy, blank=True) -+ applicable_frameworks = models.ManyToManyField(Framework, blank=True) -  - class Meta: - ordering = ['name'] -@@ -106,21 +106,21 @@ class Organization(models.Model): - """return the absolute URL for Forms, could probably do better""" - return reverse('conformity:organization_index') -  -- def get_policies(self): -- """return all Policy applicable to the Organization""" -- return self.applicable_policies.all() -+ def get_frameworks(self): -+ """return all Framework applicable to the Organization""" -+ return self.applicable_frameworks.all() -  - def remove_conformity(self, pid): - """Cascade deletion of conformity""" - with set_actor('system'): -- measure_set = Measure.objects.filter(policy=pid) -+ measure_set = Measure.objects.filter(framework=pid) - for measure in measure_set: - Conformity.objects.filter(measure=measure.id).filter(organization=self.id).delete() -  - def add_conformity(self, pid): - """Automatic creation of conformity""" - with set_actor('system'): -- measure_set = Measure.objects.filter(policy=pid) -+ measure_set = Measure.objects.filter(framework=pid) - for measure in measure_set: - conformity = Conformity(organization=self, measure=measure) - conformity.save() -@@ -134,7 +134,7 @@ class MeasureManager(models.Manager): - class Measure(models.Model): - """ - A Measure is a precise requirement. -- Measure can be hierarchical in order to form a collection of Measure, aka Policy. -+ Measure can be hierarchical in order to form a collection of Measure, aka Framework. - A Measure is not representing the conformity level, see Conformity class. - """ - objects = MeasureManager() -@@ -142,7 +142,7 @@ class Measure(models.Model): - name = models.CharField(max_length=50, blank=True, unique=True) - level = models.IntegerField(default=0) - order = models.IntegerField(default=1) -- policy = models.ForeignKey(Policy, on_delete=models.CASCADE) -+ framework = models.ForeignKey(Framework, on_delete=models.CASCADE) - parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True) - title = models.CharField(max_length=256, blank=True) - description = models.TextField(blank=True) -@@ -157,7 +157,7 @@ class Measure(models.Model): - def natural_key(self): - return (self.name) -  -- natural_key.dependencies = ['conformity.policy'] -+ natural_key.dependencies = ['conformity.framework'] -  - def get_children(self): - """Return all children of the measure""" -@@ -188,12 +188,12 @@ class Conformity(models.Model): - def natural_key(self): - return self.organization, self.measure -  -- natural_key.dependencies = ['conformity.policy', 'conformity.measure', 'conformity.organization'] -+ natural_key.dependencies = ['conformity.framework', 'conformity.measure', 'conformity.organization'] -  - def get_absolute_url(self): - """Return the absolute URL of the class for Form, probably not the best way to do it""" - return reverse('conformity:conformity_orgpol_index', -- kwargs={'org': self.organization.id, 'pol': self.measure.policy.id}) -+ kwargs={'org': self.organization.id, 'pol': self.measure.framework.id}) -  - def get_children(self): - """Return all children Conformity based on Measure hierarchy""" -@@ -259,8 +259,8 @@ def post_init_callback(instance, **kwargs): - instance.name = instance.code -  -  --@receiver(m2m_changed, sender=Organization.applicable_policies.through) --def change_policy(instance, action, pk_set, *args, **kwargs): -+@receiver(m2m_changed, sender=Organization.applicable_frameworks.through) -+def change_framework(instance, action, pk_set, *args, **kwargs): - if action == "post_add": - for pk in pk_set: - instance.add_conformity(pk) -@@ -288,7 +288,7 @@ class Audit(models.Model): - description = models.TextField(max_length=4096, blank=True) - conclusion = models.TextField(max_length=4096, blank=True) - auditor = models.CharField(max_length=256) -- audited_policies = models.ManyToManyField(Policy, blank=True) -+ audited_policies = models.ManyToManyField(Framework, blank=True) - start_date = models.DateField(null=True, blank=True) - end_date = models.DateField(null=True, blank=True) - report_date = models.DateField(null=True, blank=True) -@@ -320,7 +320,7 @@ class Audit(models.Model): - return reverse('conformity:audit_index') -  - def get_policies(self): -- """return all Policy within the Audit scope""" -+ """return all Framework within the Audit scope""" - return self.audited_policies.all() -  - def get_type(self): -diff --git a/conformity/templates/conformity/audit_detail.html b/conformity/templates/conformity/audit_detail.html -index 5d1bd8c..ba97035 100644 ---- a/conformity/templates/conformity/audit_detail.html -+++ b/conformity/templates/conformity/audit_detail.html -@@ -9,7 +9,7 @@ -

{{ audit.get_type }} realized by {{ audit.auditor }} from {{ audit.start_date }} to {{ audit.end_date }}.

 -

The following policies were within the audit scope :

 -