fix delete last label disassociate

* Inherit from mixin first in order to overwrite next inherited class
method, unattach.
* Also, fix up test and add test to ensure correct inheritance
This commit is contained in:
Chris Meyers
2016-06-29 16:46:13 -04:00
parent 6a6081dcf7
commit a57dca9786
4 changed files with 15 additions and 4 deletions

View File

@@ -452,7 +452,7 @@ class SubListCreateAttachDetachAPIView(SubListCreateAPIView):
class DeleteLastUnattachLabelMixin(object):
def unattach(self, request, *args, **kwargs):
(sub_id, res) = super(DeleteLastUnattachLabelMixin, self).unattach_validate(request, *args, **kwargs)
(sub_id, res) = super(DeleteLastUnattachLabelMixin, self).unattach_validate(request)
if res:
return res

View File

@@ -2380,7 +2380,7 @@ class JobTemplateNotificationTemplatesSuccessList(SubListCreateAttachDetachAPIVi
parent_model = JobTemplate
relationship = 'notification_templates_success'
class JobTemplateLabelList(SubListCreateAttachDetachAPIView, DeleteLastUnattachLabelMixin):
class JobTemplateLabelList(DeleteLastUnattachLabelMixin, SubListCreateAttachDetachAPIView):
model = Label
serializer_class = LabelSerializer