Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/rr 1417 implement agreed content changes in export wins django admin #5447

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions datahub/export_win/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class AdvisorInlineForm(ModelForm):
class Meta:
model = WinAdviser
fields = '__all__'
labels = {
'adviser': 'Contributing Adviser',
}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand All @@ -67,7 +70,7 @@ class AdvisorInline(BaseTabularInline):
model = WinAdviser
form = AdvisorInlineForm
fields = ('id', 'adviser', 'team_type', 'hq_team', 'location')
verbose_name_plural = 'Contributing Advisors'
verbose_name_plural = 'Contributing Advisers'


class BaseStackedInline(admin.StackedInline):
Expand Down Expand Up @@ -117,6 +120,11 @@ class WinAdminForm(ModelForm):
class Meta:
model = Win
fields = '__all__'
labels = {
'adviser': 'Creator',
'company_contacts': 'Contact name',
'total_expected_odi_value': 'Total expected ODI value',
}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -246,12 +254,12 @@ def get_adviser(self, obj):
return f'{obj.adviser} <{obj.adviser.email}>' if obj.adviser else \
f'{obj.adviser_name} <{obj.adviser_email_address}>'

get_adviser.short_description = 'User'
get_adviser.short_description = 'Creator'

def get_company(self, obj):
"""Return company name."""
return obj.company
get_company.short_description = 'Organisation or Company name'
get_company.short_description = 'Company name'

def get_date_confirmed(self, obj):
"""Return wins being confirmed."""
Expand Down Expand Up @@ -405,6 +413,6 @@ def delete_view(self, request, object_id, extra_context=None):
def has_change_permission(self, request, obj=None):
return False

get_computed_adviser_name.short_description = 'Name'
get_computed_adviser_name.short_description = 'Contributing Adviser'

WinAdviser._meta.verbose_name_plural = 'Advisors'
WinAdviser._meta.verbose_name_plural = 'Advisers'
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.11 on 2024-05-30 13:42

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('export_win', '0047_add_associated_programmes'),
]

operations = [
migrations.AlterField(
model_name='customerresponse',
name='involved_state_enterprise',
field=models.BooleanField(blank=True, default=False, null=True, verbose_name='The win involved a foreign government or state-owned enterprise (such as an intermediary or facilitator)'),
),
migrations.AlterField(
model_name='customerresponse',
name='overcame_problem',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='overcame_problem_customer_responses', to='export_win.rating', verbose_name='Overcoming a problem in the country (such as legal, regulatory, commercial)?'),
),
]
6 changes: 4 additions & 2 deletions datahub/export_win/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,16 @@ class CustomerResponse(BaseModel):
overcame_problem = models.ForeignKey(
Rating,
related_name='overcame_problem_customer_responses',
verbose_name='Overcoming a problem in the country (eg legal, regulatory, commercial)?',
verbose_name=(
'Overcoming a problem in the country (such as '
'legal, regulatory, commercial)?'),
on_delete=models.PROTECT,
null=True,
blank=True,
)
involved_state_enterprise = models.BooleanField(
verbose_name=(
'The win involved a foreign government or state-owned enterprise (eg as an '
'The win involved a foreign government or state-owned enterprise (such as an '
'intermediary or facilitator)'),
default=False,
null=True,
Expand Down
Loading