mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Fix an issue showing attach/detach docs
There's a condition in sub_list_create_api_view.md template that controls whether or not the attach/detach documentation is shown for sublist elements that support it. Looks like it's been this way for a while. This updates that condition to work anywhere it's needed
This commit is contained in:
@@ -360,6 +360,13 @@ class SubListCreateAttachDetachAPIView(SubListCreateAPIView):
|
|||||||
# Base class for a sublist view that allows for creating subobjects and
|
# Base class for a sublist view that allows for creating subobjects and
|
||||||
# attaching/detaching them from the parent.
|
# attaching/detaching them from the parent.
|
||||||
|
|
||||||
|
def get_description_context(self):
|
||||||
|
d = super(SubListCreateAttachDetachAPIView, self).get_description_context()
|
||||||
|
d.update({
|
||||||
|
"has_attach": True,
|
||||||
|
})
|
||||||
|
return d
|
||||||
|
|
||||||
def attach(self, request, *args, **kwargs):
|
def attach(self, request, *args, **kwargs):
|
||||||
created = False
|
created = False
|
||||||
parent = self.get_parent_object()
|
parent = self.get_parent_object()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ fields to create a new {{ model_verbose_name }} associated with this
|
|||||||
|
|
||||||
{% block post_create %}{% endblock %}
|
{% block post_create %}{% endblock %}
|
||||||
|
|
||||||
{% if view.attach %}
|
{% if has_attach|default:False %}
|
||||||
{% if parent_key %}
|
{% if parent_key %}
|
||||||
# Remove {{ parent_model_verbose_name|title }} {{ model_verbose_name_plural|title }}:
|
# Remove {{ parent_model_verbose_name|title }} {{ model_verbose_name_plural|title }}:
|
||||||
|
|
||||||
|
|||||||
@@ -2453,7 +2453,6 @@ class JobTemplateLabelList(SubListCreateAttachDetachAPIView, DeleteLastUnattachL
|
|||||||
serializer_class = LabelSerializer
|
serializer_class = LabelSerializer
|
||||||
parent_model = JobTemplate
|
parent_model = JobTemplate
|
||||||
relationship = 'labels'
|
relationship = 'labels'
|
||||||
parent_key = 'job_template'
|
|
||||||
|
|
||||||
class JobTemplateCallback(GenericAPIView):
|
class JobTemplateCallback(GenericAPIView):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user