Skip to content

meta_fields implementation assumes that Meta.fields is explicitly defined #181

@leifurhauks

Description

@leifurhauks

The implementation of the meta_fields functionality breaks if a serializer doesn't have an explicitly defined fields attribute on its Meta. That attribute is not required by DRF; if omitted on a ModelSerializer all the model fields are used, minus any fields listed in Meta.exclude. While it is arguably better practice to explicitly define Meta.fields, the implicit form should be supported for compatibility with upstream.

The crash occurs in the __init__ of rest_framework_json_api.serializers.ModelSerializer: a763ace#diff-8f2fdb5cb1d819dce410d6b74d0b77b6R143

I'm working on a possible fix.

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