feat(setting): Enable super admin to set ALL software categories as global
sets is_global=true and creates software categories in global organization !12 closes #30
This commit is contained in:
@ -36,6 +36,17 @@ class SoftwareCommonFields(TenancyObject, models.Model):
|
||||
|
||||
class SoftwareCategory(SoftwareCommonFields, SaveHistory):
|
||||
|
||||
|
||||
def clean(self):
|
||||
|
||||
app_settings = AppSettings.objects.get(owner_organization=None)
|
||||
|
||||
if app_settings.software_categories_is_global:
|
||||
|
||||
self.organization = app_settings.global_organization
|
||||
self.is_global = app_settings.software_categories_is_global
|
||||
|
||||
|
||||
def __str__(self):
|
||||
|
||||
return self.name
|
||||
|
@ -37,7 +37,7 @@ class View(OrganizationPermission, generic.UpdateView):
|
||||
|
||||
def get_success_url(self, **kwargs):
|
||||
|
||||
return f"/settings/software_category/{self.kwargs['pk']}/"
|
||||
return reverse('Settings:_software_category_view', args=(self.kwargs['pk'],))
|
||||
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView):
|
||||
|
||||
def get_success_url(self, **kwargs):
|
||||
|
||||
return f"/settings/software_category"
|
||||
return reverse('Settings:_software_categories')
|
||||
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
@ -88,7 +88,7 @@ class Delete(PermissionRequiredMixin, OrganizationPermission, generic.DeleteView
|
||||
|
||||
def get_success_url(self, **kwargs):
|
||||
|
||||
return f"/settings/software_category"
|
||||
return reverse('Settings:_software_categories')
|
||||
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
Reference in New Issue
Block a user