-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register multiple choice field as list #1033
Conversation
f04f777
to
1142f34
Compare
2270767
to
cf32389
Compare
@jkimbo Hey 👋 Should i create another PR for v3? |
@ulgens the way I've been handling v3 for Graphene-Django is to merge the master branch into v3 every so often. So there is no need to create a PR specifically against the v3 branch. |
@zbyte64 Any luck here? 🙂 |
cf32389
to
7aea0a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
@zbyte64 Anything missing for a merge? 🙂 |
thanks is what i was looking for. |
@SantiagoAndre This is merged to master but no new release is out yet. You can use it if you install the package over git repository. |
I found another problem, when I create DjangoFormMutation, and a form input field is a ModelMultipleChoiseFIeld, the response type of Mutation: "Payload", define this field as a list of IDS, the correct thing would be a list field of the model "Subject ", to be able to use the advantages that graphql brings when consuming the api. class MyForm(forms.Form):
subject = forms.ModelMultipleChoiceField(label = _("subjects"),
queryset=Subject.objects.all())
class CreateMonitor(DjangoFormMutation):
class Meta:
form_class = RegistryMonitorForm MutationAutomatic reponse type of model fieldHow to consume this Mutation createMonitor(input: {
subject: ["U3ViamVjdE5vZGU6MQ==","U3ViamVjdE5vZGU6Mg=="]
}) {
subject
}
-------------- RESULT --------------------------
{
"data": {
"createMonitor": {
"subject": [
"1",
"2"
],
"errors": null
}
}
} Esperated typeHow to consume this Mutation createMonitor(input: {
subject: ["U3ViamVjdE5vZGU6MQ==","U3ViamVjdE5vZGU6Mg=="]
}) {
subject{
edges{
node{
id
name
}
}
}
}
}
-------------- RESULT --------------------------
{
"data": {
"createMonitor": {
"subject": {
"edges": [
{
"node": {
"name": "subject name",
"id": "U3ViamVjdE5vZGU6MQ=="
}
}
]
},
"errors": null
}
}
} This change sounds great, could be add to next release. |
MultipleChoiceField
was registered as text input when it should be list.