feat(itam): Populate initial organization value from user default organization for Software creation
!11 #28
This commit is contained in:
@ -12,6 +12,12 @@ import requests
|
||||
|
||||
# class Test_app_structure_auth(unittest.TestCase):
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="to be written")
|
||||
def test_software_must_have_organization(user):
|
||||
""" Software must have organization set """
|
||||
pass
|
||||
|
||||
@pytest.mark.skip(reason="to be written")
|
||||
def test_software_update_is_global_no_change(user):
|
||||
"""Once software is set to global it can't be changed.
|
||||
|
@ -11,6 +11,10 @@ from itam.models.device import DeviceSoftware
|
||||
from itam.models.software import Software, SoftwareVersion
|
||||
from itam.forms.software.update import Update as SoftwareUpdate_Form
|
||||
|
||||
from settings.models.user_settings import UserSettings
|
||||
|
||||
|
||||
|
||||
class IndexView(PermissionRequiredMixin, OrganizationPermission, generic.ListView):
|
||||
model = Software
|
||||
permission_required = 'itam.view_software'
|
||||
@ -125,6 +129,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):
|
||||
|
||||
return f"/itam/software/"
|
||||
|
Reference in New Issue
Block a user