feat(config_management): assign software action to config group
!22 #43
This commit is contained in:
21
app/config_management/forms/group/add_software.py
Normal file
21
app/config_management/forms/group/add_software.py
Normal file
@ -0,0 +1,21 @@
|
||||
from django import forms
|
||||
from django.db.models import Q
|
||||
|
||||
from config_management.models.groups import ConfigGroupSoftware
|
||||
from itam.models.software import Software
|
||||
|
||||
|
||||
class SoftwareAdd(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = ConfigGroupSoftware
|
||||
fields = [
|
||||
'software',
|
||||
'action'
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
organizations = kwargs.pop('organizations')
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.fields['software'].queryset = Software.objects.filter(Q(organization_id__in=organizations) | Q(is_global = True))
|
22
app/config_management/forms/group/change_software.py
Normal file
22
app/config_management/forms/group/change_software.py
Normal file
@ -0,0 +1,22 @@
|
||||
from django import forms
|
||||
from django.db.models import Q
|
||||
|
||||
from config_management.models.groups import ConfigGroupSoftware
|
||||
from itam.models.software import Software, SoftwareVersion
|
||||
|
||||
|
||||
class SoftwareUpdate(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = ConfigGroupSoftware
|
||||
fields = [
|
||||
'action',
|
||||
'version',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.fields['version'].queryset = SoftwareVersion.objects.filter(software_id=self.instance.software.id)
|
||||
|
Reference in New Issue
Block a user