Skip to content

Commit

Permalink
Merge pull request #7 from intuitem/Mohamed-Hacene-patch-1
Browse files Browse the repository at this point in the history
Mohamed hacene patch 1
  • Loading branch information
ab-smith authored Oct 3, 2023
2 parents aaf621d + fe3b2f5 commit 3e9080b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
echo EMAIL_PORT=1025 >> .env
echo EMAIL_HOST_USER='' >> .env
echo EMAIL_HOST_PASSWORD='' >> .env
echo DJANGO_SETTINGS_MODULE=ciso_assistant.settings >> .env
#echo EMAIL_USE_TLS=False >> .env
echo CISO_URL=http://127.0.0.1:8000 >> .env
echo DEFAULT_FROM_EMAIL='[email protected]' >> .env
Expand Down
2 changes: 1 addition & 1 deletion cal/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cal.models import *
from cal.utils import *
from calendar import LocaleHTMLCalendar
from core.models import SecurityMeasure, RiskAcceptance
from core.models import SecurityMeasure
import pytest

"""
Expand Down
11 changes: 10 additions & 1 deletion core/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ class Meta:

def __str__(self) -> str:
return self.name


def clean(self) -> None:
scope = self.get_scope()
field_errors = {}
_fields_to_check = self.fields_to_check if hasattr(self, 'fields_to_check') else ['name']
if not self.is_unique_in_scope(scope=scope, fields_to_check=_fields_to_check):
field_errors['name'] = _('This name is already in use.')
super().clean()
if field_errors:
raise ValidationError(field_errors)

class AbstractBaseModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Expand Down
17 changes: 17 additions & 0 deletions core/migrations/0018_alter_evidence_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.5 on 2023-10-02 11:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('core', '0017_remove_evidence_ref_url'),
]

operations = [
migrations.AlterModelOptions(
name='evidence',
options={'verbose_name': 'Evidence', 'verbose_name_plural': 'Evidences'},
),
]
2 changes: 1 addition & 1 deletion iam/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _get_root_folder():
return None


class Folder(AbstractBaseModel, I18nMixin, NameDescriptionMixin):
class Folder(I18nMixin, NameDescriptionMixin, AbstractBaseModel):
""" A folder is a container for other folders or any object
Folders are organized in a tree structure, with a single root folder
Folders are the base perimeter for role assignments
Expand Down

0 comments on commit 3e9080b

Please sign in to comment.