Hello! My problem is next:
I have 3 classes:
Rubric, Report, ScienceEvent
And next relations:
One rubric - many reports
One event - many reports
Some words about Rubric:
Rubric has Charfield “name” with 3 possible values “chm”, “blg”, “plg” (chemistry, biology and etc.)
So, I have only 3 rubrics.
I want to pass event object in context for template
and then iterate reports of this event which relate to some rubric (for example “chm”)
So, I want something like that
{% for r in event.reports.which_rubric 'chm" %}
{% endfor %}
I can do this by writing 3 methods for ReportManager but it is bad style, I suppose
Or I can parse data in view and make list of reports which relate to this event and have rubruc “chm” but this is bad solution too for me
Or I can write custom filter like
{% for r in event.reports | which_rubric: 'chm" %}
{% endfor %}
What is the best solution?