Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mohamed hacene patch 1 #7

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading