Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Registering additional types

See original GitHub issue

Currently, only built in model field types are supported.

If you try to use alternative field types (such as currency fields provided by, they cause this error:

web_1  |   File "/usr/local/lib/python3.5/site-packages/graphene_django/", line 58, in convert_django_field
web_1  |     (field, field.__class__))
web_1  | Exception: Don't know how to convert the Django field renting.RenterProfile.phone_number (<class 'phonenumber_field.modelfields.PhoneNumberField'>)

There should probably be some API exposed to register conversions for additional field types. (Or if this is already possible, explain it in the docs.)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:15
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

clint74commented, Jun 26, 2017

@reinierpd I was getting this error and as a workaround I had to import my schema only after registering my CustomField converter.

If I put this line import cookbook.schema in the imports section the will raise the error again.

import graphene
from graphene_django.converter import convert_django_field, convert_field_to_string
from geoposition.fields import GeopositionField

def convert_geofield_to_string(field, registry=None):
     return graphene.String(description=field.help_text, required=not field.null)

import cookbook.schema

class Query(cookbook.schema.Query, graphene.ObjectType):
    # This class extends all abstract apps level Queries and graphene.ObjectType

schema = graphene.Schema(query=Query)
marbontcommented, Oct 13, 2016

I think I found a solution registering the custom field in immediately below the last import. F.i. if you need to register CustomField in the cookbook example you should have something like this:

import cookbook.ingredients.schema
import graphene
from graphene_django.converter import convert_django_field

from graphene_django.debug import DjangoDebug

def my_convert_function(field, registry=None):
    # Customization here
    return something

class Query(cookbook.ingredients.schema.Query, graphene.ObjectType):
    debug = graphene.Field(DjangoDebug, name='__debug')

schema = graphene.Schema(query=Query)

It seems working, but since there’s no documentation about this it could be terribly wrong.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Registration Types - Cvent Community
1 Access the Registration Types page. Begin by selecting your event. From the left-hand navigation, click General, then Registration Types.
Read more >
Additional Title Types | Georgia Department of Revenue
Additional Title Types · Expiration, Registration, and Mailing · Dealer Registration · Manufacturer or Distributor Registration · Transporter Registration · Side ...
Read more >
Add Registration Types - Blackbaud
Registration types are ways to group registration options. On the Event registration types page, you can add a registration type, create a unique...
Read more >
Add Advanced Registration Type - GrowthZone
The advanced registration type allows you to bundle multiple items together for the registration ... Click Add Advanced Registration Types.
Read more >
Registration vehicle types - New York DMV
You must register any vehicle owned by you or your business at a DMV office. See specific requirements for different vehicle types below....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found