Skip to content

Make multiple relationships of same kind between entities possible #688

@stefanw

Description

@stefanw

If you model a e.g. "works for" relationship, a person might have worked for an organisation many times over (e.g. from 2008 - 2009 and from 2010 - 2012). If I try to add more than one of the same relationship between the same entities, detectiveio just says "This relationship already exists."

I also tried to model this in custom JSON with the documented has_properties and through field rule, but this feature doesn't seem to work:

File detective.io/app/detective/topics/common/summary.py", line 152, in sanitize_field
    field["rules"]["through"] = getattr(field["rules"]["through"], "__name__")
AttributeError: 'unicode' object has no attribute '__name__'

The field["rules"]["through"] in sanitize_field is still the original model reference string that I put in the JSON and is not transformed into a proper Relationship.

I guess I can model multiple of the same relationships between entities by modeling an explicit "virtual relationship" entity in between (manually creating the through relationship), but this seems counterintuitive and cumbersome. Any plans to add the ability to create multiple of the same relationships or any advice how to model this?

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