Skip to content

Commit 03b147b

Browse files
committed
Merge branch 'develop' – Pending users Admin fixes
2 parents 8d02ba7 + 843f5b5 commit 03b147b

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

CHANGELOG.md

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

77
## Unreleased
88

9+
## 1.1.501
10+
11+
### Added
12+
- Remove/replace items in Membership Coordination
13+
- Rename Strategic Priorities in NS Strategic Priorities table
14+
- Use AppealHistory
15+
- SituationReport – get_for fix
16+
- N+1 fix for SituationReportViewset
17+
- Sync Molnix at every 15th minute
18+
- Increase memory for long-run sync-molnix
19+
- All Molnix positions instead of only /open
20+
- No rich text in FR summary and in society names
21+
- Fix duplicate stats generation in country page
22+
- Manual flake8 issues fix
23+
- Run black and isort
24+
- Change country_plan sector
25+
- Appealdocument reader fix
26+
- Fix boundary box and centroid map edit
27+
- Fix Token Admin page
28+
- Fix TinyMCE
29+
- Use BaseAppealnumber instead of Appealnumber in appealdoc sync
30+
931
## 1.1.500
1032

1133
### Added
@@ -2449,7 +2471,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
24492471

24502472
## 0.1.20
24512473

2452-
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.500...HEAD
2474+
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.501...HEAD
2475+
[1.1.501]: https://github.com/IFRCGo/go-api/compare/1.1.500...1.1.501
24532476
[1.1.500]: https://github.com/IFRCGo/go-api/compare/1.1.499...1.1.500
24542477
[1.1.499]: https://github.com/IFRCGo/go-api/compare/1.1.498...1.1.499
24552478
[1.1.498]: https://github.com/IFRCGo/go-api/compare/1.1.497...1.1.498

api/templates/admin/submit_line.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
{% if show_save_and_next %}<input type="submit" value="{% trans 'Save and view next one' %}" name="_save_next">{% endif %}
1313
{% if show_save_and_add_another %}<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother">{% endif %}
1414
{% if show_save_and_continue %}<input type="submit" value="{% if can_change %}{% trans 'Save and continue editing' %}{% else %}{% trans 'Save and view' %}{% endif %}" name="_continue">{% endif %}
15+
{% if show_approve_user %}<input type="submit" value="{% trans 'Approve user' %}" name="_approve_user">{% endif %}
1516
{% if show_close %}<a href="{% url opts|admin_urlname:'changelist' %}" class="closelink">{% trans 'Close' %}</a>{% endif %}
1617
{% endblock %}
1718
</div>

main/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from .celery import app as celery_app
44

55
__all__ = ["celery_app"]
6-
__version__ = "1.1.500"
6+
__version__ = "1.1.501"

registrations/admin.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from django.contrib import admin
33
from django.http import HttpResponseRedirect
44
from django.template.loader import render_to_string
5+
from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter
56
from reversion_compare.admin import CompareVersionAdmin
67

78
import registrations.models as models
@@ -22,11 +23,16 @@ class PendingAdmin(CompareVersionAdmin):
2223
"get_phone",
2324
"justification",
2425
"created_at",
26+
"email_verified",
2527
)
2628
search_fields = ("user__username", "user__email", "admin_contact_1", "admin_contact_2")
2729
list_display = ("get_username_and_mail", "get_region", "get_country", "created_at", "email_verified")
2830
actions = ("activate_users",)
29-
list_filter = ["email_verified"]
31+
list_filter = (
32+
"email_verified",
33+
("user__profile__country__region", RelatedDropdownFilter),
34+
("user__profile__country", RelatedDropdownFilter),
35+
)
3036

3137
change_form_template = "admin/pending_change_form.html"
3238
change_list_template = "admin/pending_change_list.html"
@@ -146,6 +152,20 @@ def response_change(self, request, obj):
146152
return HttpResponseRedirect(".")
147153
return super().response_change(request, obj)
148154

155+
def change_view(self, request, object_id, form_url="", extra_context=None):
156+
extra_context = {
157+
"show_approve_user": True,
158+
"show_save": False,
159+
"show_save_and_add_another": False,
160+
"show_save_and_continue": False,
161+
}
162+
return self.changeform_view(request, object_id, form_url, extra_context)
163+
164+
def save_model(self, request, obj, form, change):
165+
if "_approve_user" in request.POST:
166+
self.activate_users(request, [obj])
167+
super().save_model(request, obj, form, change)
168+
149169
def get_actions(self, request):
150170
actions = super(PendingAdmin, self).get_actions(request)
151171
return actions

0 commit comments

Comments
 (0)