Skip to content

Commit

Permalink
Rename ProviderRequest status open -> more info required
Browse files Browse the repository at this point in the history
  • Loading branch information
tortila committed Sep 6, 2023
1 parent 021a4ff commit 2c35ae7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 3.2.20 on 2023-09-06 19:10

from django.db import migrations, models


def rename_status(apps, schema_editor):
"""
Rename status OPEN to MORE INFO REQUIRED for existing ProviderRequest objects
"""
db_alias = schema_editor.connection.alias
ProviderRequest = apps.get_model("accounts", "ProviderRequest")
ProviderRequest.objects.using(db_alias).filter(status="Open").update(
status="More info required"
)


class Migration(migrations.Migration):
dependencies = [
("accounts", "0060_provider_request_consent"),
]

operations = [
migrations.AlterField(
model_name="providerrequest",
name="status",
field=models.CharField(
choices=[
("Pending review", "Pending Review"),
("Approved", "Approved"),
("Rejected", "Rejected"),
("More info required", "Open"),
("Removed", "Removed"),
],
max_length=255,
),
),
migrations.RunPython(code=rename_status, reverse_code=lambda *args: ...),
]
2 changes: 1 addition & 1 deletion apps/accounts/models/provider_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ProviderRequestStatus(models.TextChoices):
PENDING_REVIEW = "Pending review"
APPROVED = "Approved"
REJECTED = "Rejected"
OPEN = "Open"
OPEN = "More info required"
REMOVED = "Removed"


Expand Down
8 changes: 6 additions & 2 deletions apps/accounts/templates/provider_portal/request_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ <h1 class="text-6xl mb-0"><span class="uppercase">Summary of request</h1>
<p>Submitted on: {{ object.created }}</p>
<p>Status: <span class="uppercase">{{ object.status }}</span></p>

{% if object.approved_at %}
{% if object.approved_at and object.status|lower == "approved" %}
<p>Approved on: <span>{{ object.approved_at }}</span></p>
{% endif %}

{% if object.status|lower == "pending review" %}
If you want to update the information relating to this provider, please get in touch using <a target="_blank" rel="noopener noreferrer" href="https://www.thegreenwebfoundation.org/support-form/">our support form</a>.
We are currently reviewing this request. If you want to update the information relating to this provider, please get in touch using <a target="_blank" rel="noopener noreferrer" href="https://www.thegreenwebfoundation.org/support-form/">our support form</a>.
{% endif %}

{% if object.status|lower == "more info required" %}
<p class="mt-8"><a href="{% url 'provider_request_edit' object.id %}" class="btn">Update this request</a></p>
{% endif %}
</header>

Expand Down

0 comments on commit 2c35ae7

Please sign in to comment.