feat(devops): Models Git Repository must use organization from git_group
as must group if parent set
ref: #693 #515
This commit is contained in:
@ -124,6 +124,15 @@ class GitGroup(
|
||||
)
|
||||
|
||||
|
||||
def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
|
||||
|
||||
if self.parent_group:
|
||||
|
||||
self.organization = self.parent_group.organization
|
||||
|
||||
super().save(force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields)
|
||||
|
||||
|
||||
app_namespace = 'devops'
|
||||
|
||||
documentation = ''
|
||||
|
@ -136,6 +136,14 @@ class GitRepository(
|
||||
text = text,
|
||||
)
|
||||
|
||||
|
||||
def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
|
||||
|
||||
self.organization = self.git_group.organization
|
||||
|
||||
super().save(force_insert=force_insert, force_update=force_update, using=using, update_fields=update_fields)
|
||||
|
||||
|
||||
app_namespace = 'devops'
|
||||
|
||||
documentation = ''
|
||||
|
@ -50,6 +50,8 @@ class ModelSerializer(
|
||||
"""Base Git Repository"""
|
||||
_urls = serializers.SerializerMethodField('get_url')
|
||||
|
||||
organization = serializers.PrimaryKeyRelatedField( read_only = True)
|
||||
|
||||
provider_badge = BadgeField(label='Provider')
|
||||
|
||||
class Meta:
|
||||
@ -86,7 +88,6 @@ class ModelSerializer(
|
||||
'id',
|
||||
'organization',
|
||||
'display_name',
|
||||
'organization',
|
||||
'provider',
|
||||
'provider_id',
|
||||
'git_group',
|
||||
|
Reference in New Issue
Block a user