Skip to content
Snippets Groups Projects
Commit 60d2aab6 authored by Albert Feghaly's avatar Albert Feghaly
Browse files

Merge branch '171-dataset-creation-with-graphql-ignores-read_only-argument' into 'master'

Add custom CheckboxInput widget for read_only

Closes #171

See merge request !95
parents 5e3dbc8b 4170919b
No related branches found
No related tags found
1 merge request!95Add custom CheckboxInput widget for read_only
......@@ -196,12 +196,18 @@ class DataSetMutation(DjangoModelFormMutation):
class Meta:
form_class = DataSetForm
return_field_name = 'dataset'
@classmethod
def get_form_kwargs(cls, root, info, **input) -> dict:
kwargs = super().get_form_kwargs(root, info, **input)
if 'read_only' not in kwargs['data'] and 'instance' not in kwargs.keys():
kwargs['data']['read_only'] = True
return kwargs
@classmethod
def perform_mutate(cls, form, info):
object = form.save(commit=False)
if not object.pk:
object.read_only = True
object.created_by = info.context.user.profile
object.last_update_by = info.context.user.profile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment