Add scm_refspec field

Update migration syntax to Django 2

fix status bug where canceled switched to error
This commit is contained in:
AlanCoding
2019-07-17 15:23:46 -04:00
parent 0c89c6c79e
commit f1f57e45de
5 changed files with 41 additions and 13 deletions

View File

@@ -1285,7 +1285,7 @@ class OrganizationSerializer(BaseSerializer):
class ProjectOptionsSerializer(BaseSerializer):
class Meta:
fields = ('*', 'local_path', 'scm_type', 'scm_url', 'scm_branch',
fields = ('*', 'local_path', 'scm_type', 'scm_url', 'scm_branch', 'scm_refspec',
'scm_clean', 'scm_delete_on_update', 'credential', 'timeout', 'scm_revision')
def get_related(self, obj):
@@ -1311,6 +1311,8 @@ class ProjectOptionsSerializer(BaseSerializer):
attrs.pop('local_path', None)
if 'local_path' in attrs and attrs['local_path'] not in valid_local_paths:
errors['local_path'] = _('This path is already being used by another manual project.')
if attrs.get('scm_refspec') and scm_type != 'git':
errors['scm_refspec'] = _('SCM refspec can only be used with git projects.')
if errors:
raise serializers.ValidationError(errors)