mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-08-13 17:39:36 +02:00
No hard coded phone number in template
This commit is contained in:
@@ -190,7 +190,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
<li>The name of the challenge</li>
|
||||
<li>A photo or video as proof</li>
|
||||
</ul>
|
||||
<p><strong>Send it via WhatsApp to:<a href="tel:+33630211244"></strong> +33 6 30 21 12 44</a></p>
|
||||
<p>
|
||||
<strong>Send it via WhatsApp to:
|
||||
{% for num in phone_numbers %}
|
||||
<a href="https://wa.me/{{ num }}" target="_blank">{{ num }}</a>{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">{% trans "OK" %}</button>
|
||||
|
@@ -17,6 +17,7 @@ from permission.backends import PermissionBackend
|
||||
from permission.views import ProtectQuerysetMixin, ProtectedCreateView
|
||||
from django.urls import reverse_lazy
|
||||
from member.forms import ImageForm
|
||||
import phonenumbers
|
||||
|
||||
from .models import Family, Challenge, FamilyMembership, User, Achievement
|
||||
from .tables import FamilyTable, ChallengeTable, FamilyMembershipTable, AchievementTable, FamilyAchievementTable
|
||||
@@ -351,6 +352,16 @@ class FamilyManageView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView
|
||||
except FamilyMembership.DoesNotExist:
|
||||
context["user_family"] = None
|
||||
|
||||
phone_numbers = [
|
||||
u.profile.phone_number for u in User.objects.filter(
|
||||
memberships__roles__id=35,
|
||||
memberships__date_end__gte=date.today(),
|
||||
profile__phone_number__isnull=False
|
||||
).distinct()
|
||||
]
|
||||
formatted_phone_numbers = [phonenumbers.format_number(num, phonenumbers.PhoneNumberFormat.INTERNATIONAL) for num in phone_numbers if num]
|
||||
context["phone_numbers"] = formatted_phone_numbers
|
||||
|
||||
return context
|
||||
|
||||
def get_table(self, **kwargs):
|
||||
|
Reference in New Issue
Block a user