Skip to content

Commit 011bf26

Browse files
Merge pull request #1625 from IFRCGo/develop
Ingest country plan
2 parents d1cb418 + 710de79 commit 011bf26

29 files changed

+722
-19
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## Unreleased
88

9+
## 1.1.465
10+
11+
### Added
12+
- Ingest country plan
13+
914
## 1.1.464
1015

1116
### Added
@@ -2121,7 +2126,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
21212126

21222127
## 0.1.20
21232128

2124-
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.464...HEAD
2129+
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.465...HEAD
2130+
[1.1.465]: https://github.com/IFRCGo/go-api/compare/1.1.464...1.1.465
21252131
[1.1.464]: https://github.com/IFRCGo/go-api/compare/1.1.463...1.1.464
21262132
[1.1.463]: https://github.com/IFRCGo/go-api/compare/1.1.462...1.1.463
21272133
[1.1.462]: https://github.com/IFRCGo/go-api/compare/1.1.461...1.1.462

api/management/commands/ingest_appeals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def get_new_or_modified_appeals(self):
8787
# get latest BILATERALS
8888
logger.info('Querying appeals API for new appeals data (bilateral)')
8989
url = 'http://go-api.ifrc.org/api/appealbilaterals'
90-
auth = (os.getenv('APPEALS_USER'), os.getenv('APPEALS_PASS'))
90+
auth = (settings.APPEALS_USER, settings.APPEALS_PASS)
9191

9292
adapter = HTTPAdapter(max_retries=settings.RETRY_STRATEGY)
9393
sess = Session()

api/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,7 @@ def __str__(self):
19251925
return '%s | %s | %s' % (self.name, self.get_status_display(), str(self.created_at)[5:16]) # omit irrelevant 0
19261926

19271927
# Given a request containing new CronJob log row, validate and add the CronJob log row.
1928+
@staticmethod
19281929
def sync_cron(body):
19291930
new = []
19301931
errors = []

api/serializers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ class RelatedAppealSerializer(ModelSerializer):
399399
class Meta:
400400
model = Appeal
401401
fields = (
402-
'aid', 'num_beneficiaries', 'amount_requested', 'amount_funded', 'status', 'status_display', 'start_date', 'id',
402+
'aid', 'num_beneficiaries', 'amount_requested', 'code',
403+
'amount_funded', 'status', 'status_display', 'start_date', 'id',
403404
)
404405

405406

api/templates/admin/app_index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{% extends "admin/index.html" %}
2+
{% load i18n %}
3+
4+
{% block bodyclass %}{{ block.super }} app-{{ app_label }}{% endblock %}
5+
6+
{% if not is_popup %}
7+
{% block breadcrumbs %}
8+
<div class="breadcrumbs">
9+
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
10+
&rsaquo;
11+
{% for app in app_list %}
12+
{{ app.name }}
13+
{% endfor %}
14+
</div>
15+
{% if app_list.0.app_label == 'country_plan' %}
16+
<div style="position: relative; top: 4rem; right: 1rem">
17+
<ul class="object-tools"><li><a href="https://go-wiki.ifrc.org/en/admin_guide/country_plans" target="_blank" class="historylink">?</a></li>
18+
</ul>
19+
</div>
20+
{% endif %}
21+
{% endblock %}
22+
{% endif %}
23+
{% block sidebar %}{% endblock %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "admin/change_form.html" %}
2+
{% block object-tools-items %}
3+
<li>
4+
<a href="https://go-wiki.ifrc.org/en/admin_guide/country_plans" target="_blank" class="historylink">?</a>
5+
</li>
6+
{{ block.super }}
7+
{% endblock %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "reversion/change_list.html" %}
2+
{% block object-tools-items %}
3+
<li>
4+
<a href="https://go-wiki.ifrc.org/en/admin_guide/country_plans" target="_blank" class="historylink">?</a>
5+
</li>
6+
{{ block.super }}
7+
{% endblock %}

country_plan/admin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@
1212
class DataImportAdmin(admin.ModelAdmin):
1313
readonly_fields = ('errors',)
1414

15+
change_form_template = "admin/countryplan_change_form.html"
16+
change_list_template = "admin/countryplan_change_list.html"
17+
1518

1619
@admin.register(CountryPlan)
1720
class CountryPlanAdmin(admin.ModelAdmin):
1821
autocomplete_fields = ('country',)
1922
search_fields = ('country__name',)
2023
list_filter = ('is_publish',)
2124

25+
change_form_template = "admin/countryplan_change_form.html"
26+
change_list_template = "admin/countryplan_change_list.html"
27+
2228

2329
@admin.register(StrategicPriority)
2430
class StrategicPriorityAdmin(admin.ModelAdmin):

country_plan/factories.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import factory
2+
3+
from .models import CountryPlan
4+
5+
6+
class CountryPlanFactory(factory.django.DjangoModelFactory):
7+
class Meta:
8+
model = CountryPlan
File renamed without changes.

0 commit comments

Comments
 (0)