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

Commit

Permalink
edit-tender
Browse files Browse the repository at this point in the history
 -[x] change admin form of tender view
 -[x] added goods and services table in tender view
 -[x] added buyer table in tender admin
 -[x] added supplier table in tender admin view
 -[x] ordering of tender form fields fixed
 -[x] unnecessary column hide in tender view
  • Loading branch information
sonikabaniya committed Apr 6, 2021
1 parent 863e5e9 commit b179df1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
24 changes: 23 additions & 1 deletion country/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.db import models
from django.forms import TextInput
from django.utils.html import format_html
from django import forms

from content.models import CountryPartner, DataImport

Expand All @@ -17,6 +18,8 @@
TempDataImportTable,
Tender,
Topic,
Buyer,
GoodsServices
)


Expand All @@ -32,6 +35,7 @@ class EquityAdmin(admin.ModelAdmin):

admin.site.register(Language)
admin.site.register(Topic)
admin.site.register(Buyer)
admin.site.register(Supplier)
admin.site.register(EquityCategory, EquityAdmin)

Expand Down Expand Up @@ -199,20 +203,38 @@ class TempDataImportTableAdmin(admin.ModelAdmin):
class CountryPartnerAdmin(admin.ModelAdmin):
list_display = ("name", "order", "country")

# class TenderInline(admin.TabularInline):
# model = Tender

@admin.register(Country)
class CountryAdmin(admin.ModelAdmin):
# inlines = [TenderInline,]

readonly_fields = (
"covid_cases_total",
"covid_deaths_total",
"covid_data_last_updated",
"slug",
)

class GoodsAndServicesInline(admin.TabularInline):
model = GoodsServices
extra = 0
fields = ('classification_code','tender_value_local','contract_value_local','award_value_local')

@admin.register(Tender)
class TenderForm(forms.ModelForm):
class Meta:
model = Tender
fields = ('country','contract_title','contract_desc','contract_date','procurement_procedure','status','link_to_contract','no_of_bidders','supplier','buyer',)

class TenderAdmin(admin.ModelAdmin):
readonly_fields = ("contract_value_usd",)
form = TenderForm
list_display = ('id','contract_id','contract_title')
search_fields = ('id','contract_id','contract_title')
inlines = [GoodsAndServicesInline,]

admin.site.register(Tender,TenderAdmin)


@admin.register(RedFlag)
Expand Down
6 changes: 3 additions & 3 deletions covidadmin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
from vizualization.views import SlugBlogShow, SlugStaticPageShow, UpcomingEventView

from .api import api_router

# import debug_toolbar
# import debug_toolbar

admin.site.site_header = "COVID-19 Procurement Explorer"

Expand All @@ -44,7 +43,8 @@
re_path(r"^", include(wagtail_urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# if settings.DEBUG:

# if settings.DEBUG:
# urlpatterns = [
# path('__debug__/', include(debug_toolbar.urls)),
# ] + urlpatterns

0 comments on commit b179df1

Please sign in to comment.