Skip to content

'JSONSchemaField' object has no attribute 'is_hidden' #2

@srugano

Description

@srugano

Implementing the example with a JSONField :

class Category(models.Model):
    field = JSONField(default=dict)

    class Meta:
        ordering = ("-pk",)

    def __str__(self):
        return self.id

and the corresponding implementation :


schema = {
    "title": "Config Schema",
    "description": "My configutation schema",
    "type": "object",
    "properties": {
        "field": {
            "description": "List of field size",
            "type": "array"
        }
    },
    "required": [
        "field",
    ],
}

@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    formfield_overrides = {
        JSONField: {'widget': JSONSchemaWidget(schema)}
    }

But I get some errors with :

Django Version: 2.2.9
Exception Type: AttributeError
Exception Value: 'JSONSchemaField' object has no attribute 'is_hidden'
Exception Location: /Users/user/.virtualenvs/beaver/lib/python3.5/site-packages/django/forms/boundfield.py in is_hidden, line 183
Python Executable: /Users/user/.virtualenvs/beaver/bin/python

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions