def report_issue(self, issue, browser): issue_object = Issue.objects.get_or_create(content=issue)[0] issue_details = IssueDetails( sender_id=self.user_id, browser=browser, issue=issue_object ) yield self.__mail_admins("{} reported issue".format(User.objects.get(id = self.user_id).username), issue, fail_silently=True) issue_details.save() return settings.VALIDATION_IS_OK
def report_issue(request): logger.info('Saving issue: %s', hide_fields(request.POST, ('log',), huge=True)) issue = Issue.objects.get_or_create(content=request.POST['issue'])[0] issue_details = IssueDetails( sender_id=request.user.id, browser=request.POST.get('browser'), issue=issue, log=request.POST.get('log') ) issue_details.save() return HttpResponse(VALIDATION_IS_OK, content_type='text/plain')
def report_issue(self, issue, browser, version): user_id = get_user_id(self.request) issue_object = Issue.objects.get_or_create(content=issue)[0] issue_details = IssueDetails(sender_id=user_id, browser=browser, version=version, issue=issue_object) username = User.objects.get(id=user_id).username if user_id else None yield self.__mail_admins("{} reported issue".format(username), issue, fail_silently=True) issue_details.save() return settings.VALIDATION_IS_OK
def report_issue(request): logger.info('Saving issue: %s', hide_fields(request.POST, ('log', ), huge=True)) issue_text = request.POST['issue'] issue = Issue.objects.get_or_create(content=issue_text)[0] issue_details = IssueDetails(sender_id=request.user.id, browser=request.POST.get('browser'), issue=issue, log=request.POST.get('log')) try: mail_admins("{} reported issue".format(request.user.username), issue_text, fail_silently=True) except Exception as e: logging.error("Failed to send issue email because {}".format(e)) issue_details.save() return HttpResponse(settings.VALIDATION_IS_OK, content_type='text/plain')