feat(itam): Populate initial organization value from user default organization for operating system creation
!11 #28
This commit is contained in:
@ -31,6 +31,12 @@ def test_device_not_global(user):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason="to be written")
|
||||||
|
def test_device_must_have_organization(user):
|
||||||
|
""" Devices must have organization set """
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="to be written")
|
@pytest.mark.skip(reason="to be written")
|
||||||
def test_device_operating_system_version_only_one(user):
|
def test_device_operating_system_version_only_one(user):
|
||||||
"""model deviceoperatingsystem must only contain one value per device
|
"""model deviceoperatingsystem must only contain one value per device
|
||||||
|
|||||||
@ -12,6 +12,12 @@ import requests
|
|||||||
|
|
||||||
# class Test_app_structure_auth(unittest.TestCase):
|
# class Test_app_structure_auth(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason="to be written")
|
||||||
|
def test_operating_system_must_have_organization(user):
|
||||||
|
""" Operating_system must have organization set """
|
||||||
|
pass
|
||||||
|
|
||||||
@pytest.mark.skip(reason="to be written")
|
@pytest.mark.skip(reason="to be written")
|
||||||
def test_operating_system_update_is_global_no_change(user):
|
def test_operating_system_update_is_global_no_change(user):
|
||||||
"""Once operating_system is set to global it can't be changed.
|
"""Once operating_system is set to global it can't be changed.
|
||||||
|
|||||||
@ -12,6 +12,7 @@ from itam.models.device import DeviceOperatingSystem
|
|||||||
from itam.models.operating_system import OperatingSystem, OperatingSystemVersion
|
from itam.models.operating_system import OperatingSystem, OperatingSystemVersion
|
||||||
from itam.forms.operating_system.update import Update
|
from itam.forms.operating_system.update import Update
|
||||||
|
|
||||||
|
from settings.models.user_settings import UserSettings
|
||||||
|
|
||||||
|
|
||||||
class IndexView(PermissionRequiredMixin, OrganizationPermission, generic.ListView):
|
class IndexView(PermissionRequiredMixin, OrganizationPermission, generic.ListView):
|
||||||
@ -104,6 +105,13 @@ class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_initial(self):
|
||||||
|
|
||||||
|
return {
|
||||||
|
'organization': UserSettings.objects.get(user = self.request.user).default_organization
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_success_url(self, **kwargs):
|
def get_success_url(self, **kwargs):
|
||||||
|
|
||||||
return reverse('ITAM:Operating Systems')
|
return reverse('ITAM:Operating Systems')
|
||||||
|
|||||||
Reference in New Issue
Block a user