graphene-django/graphene_django/rest_framework/models.py
James 5d7a04fce9
Update mutation.py to serialize Enum objects into input values (#1431)
* Fix for issue #1385: Update mutation.py to serialize Enum objects into input values for ChoiceFields

* Update graphene_django/rest_framework/mutation.py

Co-authored-by: Steven DeMartini <1647130+sjdemartini@users.noreply.github.com>

---------

Co-authored-by: Steven DeMartini <1647130+sjdemartini@users.noreply.github.com>
2023-07-27 02:41:40 +03:00

28 lines
665 B
Python

from django.db import models
class MyFakeModel(models.Model):
cool_name = models.CharField(max_length=50)
created = models.DateTimeField(auto_now_add=True)
class MyFakeModelWithPassword(models.Model):
cool_name = models.CharField(max_length=50)
password = models.CharField(max_length=50)
class MyFakeModelWithDate(models.Model):
cool_name = models.CharField(max_length=50)
last_edited = models.DateField()
class MyFakeModelWithChoiceField(models.Model):
class ChoiceType(models.Choices):
ASDF = "asdf"
HI = "hi"
choice_type = models.CharField(
max_length=4,
default=ChoiceType.HI.name,
)