-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from Esmat-Farjad/filter_project
project filter fixed
- Loading branch information
Showing
9 changed files
with
127 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import django_filters | ||
from django import forms | ||
|
||
from rh.models import ActivityDomain, Cluster, Location, Organization | ||
from .models import ProjectMonthlyReport | ||
|
||
|
||
class ReportFilterForm(django_filters.FilterSet): | ||
clusters = django_filters.ModelMultipleChoiceFilter( | ||
# field_name='test', | ||
# to_field_name='project', | ||
queryset=Cluster.objects.all(), | ||
widget=forms.SelectMultiple(), | ||
) | ||
organization = django_filters.ModelMultipleChoiceFilter( | ||
queryset=Organization.objects.all(), | ||
widget=forms.SelectMultiple(), | ||
) | ||
activity_domains = django_filters.ModelChoiceFilter( | ||
queryset=ActivityDomain.objects.all(), | ||
widget=forms.SelectMultiple(), | ||
) | ||
country = django_filters.ModelChoiceFilter( | ||
queryset=Location.objects.filter(type="Country"), | ||
widget=forms.Select(), | ||
) | ||
province = ( | ||
django_filters.ModelChoiceFilter(queryset=Location.objects.filter(type="Province"), widget=forms.Select()), | ||
) | ||
district = django_filters.ModelChoiceFilter( | ||
queryset=Location.objects.filter(type="District"), | ||
widget=forms.Select(), | ||
) | ||
|
||
class Meta: | ||
model = ProjectMonthlyReport | ||
fields = "__all__" |
18 changes: 18 additions & 0 deletions
18
src/project_reports/migrations/0005_alter_activityplanreport_report_types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.0.6 on 2023-12-27 03:31 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("rh", "0012_merge_20231220_0933"), | ||
("project_reports", "0004_activityplanreport_target_achieved"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="activityplanreport", | ||
name="report_types", | ||
field=models.ManyToManyField(blank=True, to="rh.reporttype"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters