Giter Site home page Giter Site logo

Comments (4)

 avatar commented on May 29, 2024

I managed to fix this by changing graphene_django_cud\converter.py:

            if from_registry:
                if hasattr(from_registry, 'kwargs'):
                    from_registry.kwargs['description'] = field.help_text
                    from_registry.kwargs['required'] = is_required(field, required)
                else:
                    from_registry.description = field.help_text
                    from_registry.required = is_required(field, required)
                return from_registry

from graphene-django-cud.

NwawelAIroume avatar NwawelAIroume commented on May 29, 2024
python version 3.10.3
django version 4.0.3
graphene-django from main branch latest commit by date of posting(f6ec0689c18929344c79ae363d2e3d5628fa4a2d)
graphene_django_cud version 0.10.0

I was trying to create a DjangoCreateMutation(actually it fails for any kind of mutation) with this model

from django.db import models
from django.contrib.auth import get_user_model


User = get_user_model()


class Staff(models.Model):
    class StaffStatus(models.TextChoices):
        WORKING = 'working', 'Working'
        SUSPENDED = 'suspended', 'Suspended'
        FIRED = 'fired', 'Fired'

    first_name = models.CharField(max_length=64)
    middle_name = models.CharField(max_length=64)
    last_name = models.CharField(max_length=64)
    phone = models.CharField(max_length=32)
    email = models.CharField(max_length=256)
    position = models.CharField(max_length=64)
    address = models.CharField(max_length=512)
    status = models.CharField(max_length=16, choices=StaffStatus.choices, default=StaffStatus.WORKING)
    is_admin = models.BooleanField(default=False)

    user = models.OneToOneField(User, on_delete=models.SET_NULL, null=True, related_name='staff')

    def __str__(self):
        return f'{self.last_name} {self.first_name}({self.id})'

I suppose most of the fields can be skipped except the one with choices which was created via class _(models.TextChoices) or its analogues in it.

And when I tried to run app it fails with message

File "lib\site-packages\graphene_django_cud\converter.py", line 116, in convert_django_field_with_choices     
    from_registry.kwargs['description'] = field.help_text
AttributeError: 'BlankValueField' object has no attribute 'kwargs'. Did you mean: 'args'?

you have this issue because you have graphene-django==3.0.0b7. if you downgrade it to graphene-django==2.15.0 you will not have this issue

from graphene-django-cud.

digitiamo-nic avatar digitiamo-nic commented on May 29, 2024

I also have the same problemi with following libs:

Python                        3.10.6
Django                        4.2.2
graphene                    3.2.2
graphene-django        3.0.0
graphene-django-cud 0.10.0

from graphene-django-cud.

tOgg1 avatar tOgg1 commented on May 29, 2024

Closed with version 0.11.0.

from graphene-django-cud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.