Method to save the updated data for StyleEnabled api.
(root, info, input=None)
| 620 | |
| 621 | @staticmethod |
| 622 | def mutate(root, info, input=None): |
| 623 | """Method to save the updated data for StyleEnabled api.""" |
| 624 | ok = False |
| 625 | user = info.context.user |
| 626 | libraries = Library.objects.filter(users__user=user, users__owner=True, id=input.library_id) |
| 627 | if libraries and str(input.get('classification_style_enabled')) != 'None': |
| 628 | library_obj = libraries[0] |
| 629 | library_obj.classification_style_enabled = input.classification_style_enabled |
| 630 | library_obj.save() |
| 631 | ok = True |
| 632 | return UpdateLibraryStyleEnabled( |
| 633 | ok=ok, |
| 634 | classification_style_enabled=library_obj.classification_style_enabled) |
| 635 | if not libraries: |
| 636 | raise Exception('User is not the owner of library!') |
| 637 | else: |
| 638 | return UpdateLibraryStyleEnabled(ok=ok, classification_style_enabled=None) |
| 639 | |
| 640 | |
| 641 | class UpdateLibraryObjectEnabled(graphene.Mutation): |
nothing calls this directly
no test coverage detected