diff --git a/core/lib/customers.py b/core/lib/customers.py index d15c9d9..35f05a9 100644 --- a/core/lib/customers.py +++ b/core/lib/customers.py @@ -56,13 +56,10 @@ def update_customer_fields(stripe_id, email=None, first_name=None, last_name=Non """ Update the customer fields in Stripe. """ - print("Update customer fields called") if email: - print("Email modified") stripe.Customer.modify(stripe_id, email=email) logger.info(f"Modified Stripe customer {stripe_id} to have email {email}") if first_name or last_name: - print("Name modified") name = expand_name(first_name, last_name) stripe.Customer.modify(stripe_id, name=name) logger.info(f"Modified Stripe customer {stripe_id} to have email {name}") diff --git a/core/templates/old/drilldown.html b/core/templates/old/drilldown.html deleted file mode 100644 index 03f110c..0000000 --- a/core/templates/old/drilldown.html +++ /dev/null @@ -1,182 +0,0 @@ -{% extends "base.html" %} -{% load static %} -{% block content %} -
-
- {% csrf_token %} -
- -
-
-
- - - - -
-
-
-
- -
-
- -
-
-
-
- - - - -
-
-
-
-
-
- - -
-
-
- - - - -
-
-
-
-
- -
-
-
- - - - -
-
-
-
-
- -
-
- - -
-
- -
-
- {% if results is not None %} -
-
- - - - - - - - - - - - - - {% for item in results %} - - - - - - - - - {% endfor %} - -
TSmsghostnickchannelnet
{{ item.ts }}{{ item.msg }}{{ item.host }}{{ item.nick }}{{ item.channel }}{{ item.net }}
-
-
-
-
-
-

{{ card }} hits

-
- {% if redacted != 0 %} -
-

{{ redacted }} redacted

-
- {% endif %} - - {% if exemption is not None %} -
-

god mode

-
- {% endif %} -
-

{{ took }}ms

-
-
-
- -
-
-
- - - - - -
-
-
-
- - - - -
-
-
- - {% endif %} - -{% endblock %} diff --git a/core/templates/ui/chart.html b/core/templates/ui/chart.html deleted file mode 100644 index af8c093..0000000 --- a/core/templates/ui/chart.html +++ /dev/null @@ -1,11 +0,0 @@ -{% load static %} - - - - - - - - - - \ No newline at end of file diff --git a/core/templates/ui/results.html b/core/templates/ui/results.html index 9251cba..d3b158c 100644 --- a/core/templates/ui/results.html +++ b/core/templates/ui/results.html @@ -1,16 +1,12 @@ {% load static %}
-{% if results is not None %} - -
-
-
- - - -
-
+ {% if results is not None %} + +
+ +
diff --git a/core/views/__init__.py b/core/views/__init__.py index 6f7d219..b54ce10 100644 --- a/core/views/__init__.py +++ b/core/views/__init__.py @@ -1,5 +1,4 @@ import logging -import pprint import stripe from django.conf import settings @@ -15,7 +14,6 @@ from core.lib.products import assemble_plan_map from core.models import ContentBlock, Plan, Session logger = logging.getLogger(__name__) -pp = pprint.PrettyPrinter(indent=4) # Create your views here diff --git a/core/views/dynamic/search.py b/core/views/dynamic/search.py index 2de083c..231458c 100644 --- a/core/views/dynamic/search.py +++ b/core/views/dynamic/search.py @@ -1,14 +1,13 @@ -from rest_framework.views import APIView -import logging -from django.conf import settings -from django.shortcuts import render -from django.http import HttpResponse, JsonResponse -from django.contrib.auth.mixins import LoginRequiredMixin import json -from django.views.decorators.csrf import csrf_exempt + +from django.conf import settings +from django.contrib.auth.mixins import LoginRequiredMixin +from django.http import HttpResponse, JsonResponse +from django.shortcuts import render from django.views import View -from rest_framework.parsers import JSONParser + from core.lib.opensearch import initialise_opensearch, run_main_query + client = initialise_opensearch() @@ -23,7 +22,6 @@ def query_results(request, post_params, api=False): results = run_main_query(client, request.user, query, fields, size) if not results: return False - # pp.pprint(results) results_parsed = [] if "hits" in results.keys(): if "hits" in results["hits"]: @@ -42,45 +40,41 @@ def query_results(request, post_params, api=False): } return context + class Search(LoginRequiredMixin, View): - #parser_classes = [JSONParser] + # parser_classes = [JSONParser] template_name = "ui/results.html" plan_name = "drilldown" def post(self, request): if not request.user.has_plan(self.plan_name): return render(request, "denied.html") - + context = query_results(request, request.POST) - print("context: ", context) - context['data'] = json.dumps( + context["data"] = json.dumps( [ { - 'id': item.get('id'), - 'value': item.get("sentiment", 0), - 'date': item.get("ts"), + "id": item.get("id"), + "value": item.get("sentiment", 0), + "date": item.get("ts"), } for item in context["results"] ] ) - print("context['data']: ", context['data']) if context: - print("OGING TO RENDER") return render(request, self.template_name, context) else: return HttpResponse("No results") + class APISearch(LoginRequiredMixin, View): - #parser_classes = [JSONParser] + # parser_classes = [JSONParser] template_name = "ui/results.html" plan_name = "drilldown" def post(self, request): - print("POST") if not request.user.has_plan(self.plan_name): return JsonResponse({"success": False}) - print("PERMS") - + context = query_results(request, request.POST) - print("CONTEXT", context) return JsonResponse(context)