index.py 619 B

12345678910111213141516171819202122
  1. from django.views.generic import TemplateView
  2. from django.utils.translation import gettext as _
  3. from .base import BaseView
  4. class IndexView(BaseView, TemplateView):
  5. page_title = _('Home/Balance')
  6. page_name = 'index'
  7. template_name = 'sharix_admin/main.html'
  8. def get_context_data(self, **kwargs):
  9. context = super().get_context_data(**kwargs)
  10. ph_num = str(self.request.user.phone_number)
  11. convert_ph_num = f"+{ph_num[:1]} ({ph_num[1:4]}) {ph_num[4:7]}-{ph_num[7:9]}-{ph_num[9:11]}"
  12. context.update({
  13. 'phone': convert_ph_num,
  14. })
  15. return context