Skip to content

Complex relations #9

Closed
Closed
@cristi23

Description

Does your project intend to support complex relations?

I'll give you an example:

I have a model called Resource which has a foreign key on field project (for model Project)
The Project model also has a foreign key on field organization (for model Organization)

Therefore, one Organization can have many Projects and each Project can have many Resources.

In the ResourceReport (model = Resource) I have the following fields:

fields = [
'title', # --> title field belongs to the Resource
'type', # --> type field belongs to the Resource
'project__title', # --> title field belongs to the Project associated with the Resource
'project__organization__name', # --> name field belongs to the Organization which is associated with the Project associated with the Resource
]

Grouping works fine by using this config:

list_group_by = (
'project__organization__name',
'project__title',
'type',
)

However, filtering does not, even though the config should basically be the same:

list_filter = (
'project__organization__name',
'project__title',
'type',
)

The report renders 2 select fields with different ids and names (project__title and project__organization__name) but the options are the same in the two select fields (both of them have been populated with project__title values). Also the labels are the same (the label that should be used for the project__title select is used for both select fields).

Should your project work for this case and this is a bug or you didn't cover this kind of relations when you designed it?

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions