From 6ea5e2bbaf7de64e0bd68dd06a6470eae0fc2246 Mon Sep 17 00:00:00 2001
From: Olivia Rodriguez Valdes <olicubalibre@gmail.com>
Date: Sun, 3 Mar 2019 15:33:11 -0500
Subject: [PATCH] Update converter

---
 graphene_django/forms/converter.py | 14 ++++++++++++--
 graphene_django/forms/mutation.py  |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/graphene_django/forms/converter.py b/graphene_django/forms/converter.py
index 8b92a8e..bbaba98 100644
--- a/graphene_django/forms/converter.py
+++ b/graphene_django/forms/converter.py
@@ -86,7 +86,13 @@ def convert_form_field_to_id(field):
     return ID(required=field.required)
 
 
-def convert_form_field_with_choices(name, field):
+def get_form_name(form):
+    """Get form name"""
+    class_name = str(form.__class__).split('.')[-1]
+    return class_name[:-2]
+
+
+def convert_form_field_with_choices(field, name=None, form=None):
     """
     Helper method to convert a field to graphene Field type.
     :param name: form field's name
@@ -96,7 +102,11 @@ def convert_form_field_with_choices(name, field):
     choices = getattr(field, 'choices', None)
 
     if choices:
-        name = to_camel_case(field.label or name)
+        if form:
+            name = to_camel_case("{}_{}".format(get_form_name(form), field.label or name))
+        else:
+            name = field.label or name
+        name = to_camel_case(name.replace(' ', '_'))
         choices = list(get_choices(choices))
         named_choices = [(c[0], c[1]) for c in choices]
         named_choices_descriptions = {c[0]: c[2] for c in choices}
diff --git a/graphene_django/forms/mutation.py b/graphene_django/forms/mutation.py
index 0b64c46..4bc3075 100644
--- a/graphene_django/forms/mutation.py
+++ b/graphene_django/forms/mutation.py
@@ -30,7 +30,7 @@ def fields_for_form(form, only_fields, exclude_fields):
         if is_not_in_only or is_excluded:
             continue
 
-        fields[name] = convert_form_field_with_choices(name, field)
+        fields[name] = convert_form_field_with_choices(field, name=name, form=form)
     return fields