Replace {} as field default values with the callable dict

This commit is contained in:
Jeff Bradberry
2019-07-09 13:26:58 -04:00
parent 29ad847544
commit 6737bd4c19
17 changed files with 60 additions and 60 deletions

View File

@@ -105,7 +105,7 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
)
inputs = CredentialInputField(
blank=True,
default={},
default=dict,
help_text=_('Enter inputs using either JSON or YAML syntax. Use the '
'radio button to toggle between the two. Refer to the '
'Ansible Tower documentation for example syntax.')
@@ -343,14 +343,14 @@ class CredentialType(CommonModelNameNotUnique):
)
inputs = CredentialTypeInputField(
blank=True,
default={},
default=dict,
help_text=_('Enter inputs using either JSON or YAML syntax. Use the '
'radio button to toggle between the two. Refer to the '
'Ansible Tower documentation for example syntax.')
)
injectors = CredentialTypeInjectorField(
blank=True,
default={},
default=dict,
help_text=_('Enter injectors using either JSON or YAML syntax. Use the '
'radio button to toggle between the two. Refer to the '
'Ansible Tower documentation for example syntax.')
@@ -1117,7 +1117,7 @@ class CredentialInputSource(PrimordialModel):
)
metadata = DynamicCredentialInputField(
blank=True,
default={}
default=dict
)
def clean_target_credential(self):

View File

@@ -149,7 +149,7 @@ class BasePlaybookEvent(CreatedModifiedModel):
)
event_data = JSONField(
blank=True,
default={},
default=dict,
)
failed = models.BooleanField(
default=False,
@@ -567,7 +567,7 @@ class BaseCommandEvent(CreatedModifiedModel):
event_data = JSONField(
blank=True,
default={},
default=dict,
)
uuid = models.CharField(
max_length=1024,

View File

@@ -650,7 +650,7 @@ class Host(CommonModelNameNotUnique, RelatedJobsMixin):
)
ansible_facts = JSONBField(
blank=True,
default={},
default=dict,
help_text=_('Arbitrary JSON structure of most recent ansible_facts, per-host.'),
)
ansible_facts_modified = models.DateTimeField(

View File

@@ -485,7 +485,7 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin, TaskMana
)
artifacts = JSONField(
blank=True,
default={},
default=dict,
editable=False,
)
scm_revision = models.CharField(
@@ -847,7 +847,7 @@ class LaunchTimeConfigBase(BaseModel):
# This is a solution to the nullable CharField problem, specific to prompting
char_prompts = JSONField(
blank=True,
default={}
default=dict
)
def prompts_dict(self, display=False):
@@ -927,11 +927,11 @@ class LaunchTimeConfig(LaunchTimeConfigBase):
# Special case prompting fields, even more special than the other ones
extra_data = JSONField(
blank=True,
default={}
default=dict
)
survey_passwords = prevent_search(JSONField(
blank=True,
default={},
default=dict,
editable=False,
))
# Credentials needed for non-unified job / unified JT models

View File

@@ -100,7 +100,7 @@ class SurveyJobTemplateMixin(models.Model):
)
survey_spec = prevent_search(JSONField(
blank=True,
default={},
default=dict,
))
ask_variables_on_launch = AskForField(
blank=True,
@@ -360,7 +360,7 @@ class SurveyJobMixin(models.Model):
survey_passwords = prevent_search(JSONField(
blank=True,
default={},
default=dict,
editable=False,
))

View File

@@ -641,7 +641,7 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
)
job_env = prevent_search(JSONField(
blank=True,
default={},
default=dict,
editable=False,
))
job_explanation = models.TextField(

View File

@@ -180,7 +180,7 @@ class WorkflowJobNode(WorkflowNodeBase):
)
ancestor_artifacts = JSONField(
blank=True,
default={},
default=dict,
editable=False,
)
do_not_run = models.BooleanField(