def index_view(request): if request.method == 'GET': page = request.GET.get('page', 1) obj = ClientObject(request.user) context = { 'user': obj.get_user(), 'profile': obj.get_user_profile(), 'client': obj.get_user_client(), 'counts': obj.get_counts(), 'balance': obj.get_client_balance(), 'projects': Pagination(obj.get_client_projects(), 10).get_page(page), 'messages': [ get_status_message(get_message_info(request), obj.language), { 'message': obj.get_error_message(), 'code': 'danger' } ], 'dictionary': get_language_dictionary(obj.language), } return render(request, 'project/index.html', context) raise Http404
def index_view(request): if request.method == 'GET': obj = ClientObject(request.user) context = { 'user': obj.get_user(), 'profile': obj.get_user_profile(), 'client': obj.get_user_client(), 'counts': obj.get_counts(), 'balance': obj.get_client_balance(), 'projects': obj.get_notified_projects(), 'hosting': obj.get_notified_hosting(), 'consults': obj.get_notified_consults(), 'messages': [ get_status_message(get_message_info(request), obj.language), { 'message': obj.get_error_message(), 'code': 'danger' } ], 'dictionary': get_language_dictionary(obj.language), } return render(request, 'home/index.html', context) raise Http404
def project_view(request, pk): if request.method == 'GET': tab = request.GET.get('tab', '') pages = get_page_numbers(request) obj = ClientObject(request.user) context = { 'user': obj.get_user(), 'profile': obj.get_user_profile(), 'client': obj.get_user_client(), 'counts': obj.get_counts(), 'project': obj.get_project(pk), 'required_actions': obj.get_project_required_actions(), 'timeline': obj.get_project_timeline(), 'hosting': Pagination(obj.get_project_hosting(), 10).get_page(pages['hosting_page']), 'bills': Pagination(obj.get_project_bills(), 10).get_page(pages['bill_page']), 'files': Pagination(obj.get_project_files(), 10).get_page(pages['file_page']), 'chat': obj.get_project_chat(), 'messages': [ get_status_message(get_message_info(request), obj.language), { 'message': obj.get_error_message(), 'code': 'danger' } ], 'dictionary': get_language_dictionary(obj.language), 'tab': tab, } return render(request, 'project/project.html', context) raise Http404
def hosting_view(request, pk): if request.method == 'GET': tab = request.GET.get('tab', '') page = request.GET.get('page', 1) obj = ClientObject(request.user) context = { 'user': obj.get_user(), 'profile': obj.get_user_profile(), 'client': obj.get_user_client(), 'counts': obj.get_counts(), 'hosting': obj.get_hosting(pk), 'events': obj.get_hosting_events(), 'bills': Pagination(obj.get_hosting_bills(), 10).get_page(page), 'chat': obj.get_hosting_chat(), 'messages': [ get_status_message(get_message_info(request), obj.language), { 'message': obj.get_error_message(), 'code': 'danger' } ], 'dictionary': get_language_dictionary(obj.language), 'tab': tab, } return render(request, 'hosting/hosting.html', context) raise Http404
def client_change_password(request): if request.method == 'POST': obj = ClientObject(request.user) try: with transaction.atomic(): if obj.change_password(request.POST.copy()): login(request, obj.get_user()) return JsonResponse(SUCCESS_DICT, status=200) else: raise IntegrityError except IntegrityError as e: return JsonResponse( { 'status': 'error', 'error': obj.get_error_message() + '\n' + str(e), 'errors': obj.get_form_errors() }, status=200) raise Http404
def profile_view(request): if request.method == 'GET': obj = ClientObject(request.user) context = { 'user': obj.get_user(), 'profile': obj.get_user_profile(), 'client': obj.get_user_client(), 'messages': [ get_status_message(get_message_info(request), obj.language), { 'message': obj.get_error_message(), 'code': 'danger' } ], 'dictionary': get_language_dictionary(obj.language), } return render(request, 'home/profile.html', context) raise Http404