Skip to content

Unable to set reverse_delte_rule to GenericReferenceField. AttributeError: 'GenericReferenceField' object has no attribute 'document_type' #2308

Open
@chavus

Description

@chavus

I get the following error when trying to add "reverse_delete_rule=db.CASCADE" to a GenericReferenceField:

AttributeError: 'GenericReferenceField' object has no attribute 'document_type'

This is my code:

`from database.db import db

class Movie(db.DynamicDocument):
name = db.StringField(required=True, unique=True)
casts = db.ListField(db.StringField)
genres = db.ListField(db.StringField)
directors = db.GenericReferenceField(reverse_delete_rule=db.CASCADE)
`

This is the error:
AttributeError: 'GenericReferenceField' object has no attribute 'document_type'

My understanding is that GenericReferenceField inherits ReferenceField attributes.

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