Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #287 from open-contracting/CPA-286
Browse files Browse the repository at this point in the history
country filter in edit tender
  • Loading branch information
KushalRaj committed May 3, 2021
2 parents 0811099 + 513fb1c commit 4f352c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion country/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,17 @@ class Meta:
"buyer",
)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["buyer"].queryset = Buyer.objects.filter(tenders__country=self.instance.country)
self.fields["supplier"].queryset = Supplier.objects.filter(tenders__country=self.instance.country)


class TenderAdmin(admin.ModelAdmin):
form = TenderForm
list_display = ("contract_id", "contract_title", "country", "contract_date")
search_fields = ("id", "contract_id", "contract_title")
autocomplete_fields = ["buyer", "supplier"]
# autocomplete_fields = ["buyer", "supplier"]
inlines = [
GoodsAndServicesInline,
]
Expand Down

0 comments on commit 4f352c8

Please sign in to comment.