diff --git a/TealCode/TealCode/settings.py b/TealCode/TealCode/settings.py
index ec8793c..cb59c68 100644
--- a/TealCode/TealCode/settings.py
+++ b/TealCode/TealCode/settings.py
@@ -41,8 +41,6 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'main.apps.MainConfig',
- 'analytics.apps.AnalyticsConfig',
- 'ipware',
]
MIDDLEWARE = [
diff --git a/TealCode/TealCode/urls.py b/TealCode/TealCode/urls.py
index 1f36fb8..f0e7848 100644
--- a/TealCode/TealCode/urls.py
+++ b/TealCode/TealCode/urls.py
@@ -19,7 +19,6 @@ from django.views.generic.base import TemplateView
urlpatterns = [
path('', include('main.urls')),
- path('analytics/', include('analytics.urls')),
path("robots.txt", TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
path('AD/SDGFOLKJASDNVASDFASDFSLAKDF/', admin.site.urls),
]
diff --git a/TealCode/analytics/__init__.py b/TealCode/analytics/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/TealCode/analytics/admin.py b/TealCode/analytics/admin.py
deleted file mode 100644
index 4cd3091..0000000
--- a/TealCode/analytics/admin.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from django.contrib import admin
-
-from analytics.models import View
-
-admin.site.register(View)
\ No newline at end of file
diff --git a/TealCode/analytics/apps.py b/TealCode/analytics/apps.py
deleted file mode 100644
index 258d4dd..0000000
--- a/TealCode/analytics/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class AnalyticsConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'analytics'
diff --git a/TealCode/analytics/migrations/0001_initial.py b/TealCode/analytics/migrations/0001_initial.py
deleted file mode 100644
index 95dc493..0000000
--- a/TealCode/analytics/migrations/0001_initial.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated by Django 3.2.9 on 2021-11-22 18:23
-
-from django.db import migrations, models
-import django.db.models.deletion
-import django.utils.timezone
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ('main', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='View',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('ip', models.CharField(max_length=200)),
- ('date', models.DateTimeField(default=django.utils.timezone.now)),
- ('admin', models.BooleanField(default=False)),
- ('home', models.BooleanField(default=False)),
- ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='main.category')),
- ('topic', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='main.topic')),
- ],
- ),
- ]
diff --git a/TealCode/analytics/migrations/__init__.py b/TealCode/analytics/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/TealCode/analytics/models.py b/TealCode/analytics/models.py
deleted file mode 100644
index fc47be0..0000000
--- a/TealCode/analytics/models.py
+++ /dev/null
@@ -1,17 +0,0 @@
-from django.db import models
-
-from django.utils import timezone
-from main.models import Topic, Category
-
-class View(models.Model):
- ip = models.CharField(max_length=200)
- date = models.DateTimeField(default=timezone.now)
- topic = models.ForeignKey(Topic, on_delete=models.CASCADE, blank=True, null=True)
- category = models.ForeignKey(Category, on_delete=models.CASCADE, blank=True, null=True)
- admin = models.BooleanField(default=False)
- home = models.BooleanField(default=False)
-
-
-
- def __str__(self):
- return self.ip
diff --git a/TealCode/analytics/templates/analytics/index.html b/TealCode/analytics/templates/analytics/index.html
deleted file mode 100644
index 532307b..0000000
--- a/TealCode/analytics/templates/analytics/index.html
+++ /dev/null
@@ -1,20 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
-
Analytics
-
-
-
Clicks Last 30 Days
-
-
-
-
Clicks In Total
-
-
-
-
Clicks From Coutries Last 30 Days
-
-
-
-
Clicks From Coutries In Total
-
-{% endblock content %}
\ No newline at end of file
diff --git a/TealCode/analytics/tests.py b/TealCode/analytics/tests.py
deleted file mode 100644
index 7ce503c..0000000
--- a/TealCode/analytics/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/TealCode/analytics/urls.py b/TealCode/analytics/urls.py
deleted file mode 100644
index 64abca1..0000000
--- a/TealCode/analytics/urls.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.urls import path
-from . import views
-
-urlpatterns = [
- path('', views.index, name="analytics-index"),
-]
diff --git a/TealCode/analytics/views.py b/TealCode/analytics/views.py
deleted file mode 100644
index 69c4b4b..0000000
--- a/TealCode/analytics/views.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.shortcuts import render
-from django.contrib.auth.decorators import login_required
-
-@login_required
-def index(req):
- return render(req, 'analytics/index.html')
\ No newline at end of file
diff --git a/TealCode/main/migrations/0001_initial.py b/TealCode/main/migrations/0001_initial.py
index a09312d..b962df3 100644
--- a/TealCode/main/migrations/0001_initial.py
+++ b/TealCode/main/migrations/0001_initial.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.2.9 on 2021-11-22 18:23
+# Generated by Django 3.2.9 on 2021-11-23 17:55
from django.db import migrations, models
import django.db.models.deletion
diff --git a/TealCode/main/static/js/cookies.js b/TealCode/main/static/js/cookies.js
new file mode 100644
index 0000000..6bdfa63
--- /dev/null
+++ b/TealCode/main/static/js/cookies.js
@@ -0,0 +1,22 @@
+function accept_cookies(){
+ document.cookie = "cookies_allowed=1;path=/";
+ window.location.reload();
+}
+
+document.write('We only use non-technical cookies for analysis purposes.
Do you want to accept those cookies? (please)
');
+
+cookies_allowed = document.cookie.split("cookies_allowed=")[1][0]
+
+if(cookies_allowed == null){
+ document.cookie = "cookies_allowed=0;path=/";
+ cookies_allowed = document.cookie.split("cookies_allowed=")[1]
+}
+if(cookies_allowed == "1"){
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+ gtag('config', 'G-PGM5LTFSMG');
+ document.getElementById("cookie_banner").style.display = "none";
+}else if(cookies_allowed == "0"){
+ console.log("DO NOT LOAD ANALYTILCS");
+}
\ No newline at end of file
diff --git a/TealCode/main/templates/base.html b/TealCode/main/templates/base.html
index 7f78ed7..2b84599 100644
--- a/TealCode/main/templates/base.html
+++ b/TealCode/main/templates/base.html
@@ -2,6 +2,13 @@
+
+
+
+
+
+
+
@@ -26,31 +33,7 @@
{% endif %}
-
-
-
-
We only use non-technical cookies for analysis purposes.
Do you want to accept those cookies? (please)
-
-
-
+
diff --git a/TealCode/main/views.py b/TealCode/main/views.py
index 3652c9a..14d14e1 100644
--- a/TealCode/main/views.py
+++ b/TealCode/main/views.py
@@ -1,11 +1,8 @@
-from django.http.response import HttpResponse, HttpResponseForbidden
+from django.http.response import HttpResponse
from django.shortcuts import render, redirect
from .models import Category, Topic, Rating
-from analytics.models import View
def index(req):
- view = View(ip=get_ip(req), home=True)
- view.save()
categorys_obj = Category.objects.all()
return render(req, "main/index.html", {'categorys': categorys_obj})
@@ -40,10 +37,6 @@ def topic(req, category, topic):
'notHelpful_count': notHelpful_count,
'read_more': topic_obj.read_more,
}
-
-
- view = View(ip=get_ip(req), topic=topic_obj)
- view.save()
return render(req, "main/topic.html", context)
return redirect("main-index")
@@ -57,9 +50,6 @@ def category(req, category):
if category_obj:
topics_obj = Topic.objects.filter(category=category_obj)
- view = View(ip=get_ip(req), category=category_obj)
- view.save()
-
context = {
'category_obj': category_obj,
'topics': topics_obj,
@@ -83,8 +73,6 @@ def search(req, value): # https://django-taggit.readthedocs.io/en/latest/getting
def sitemap(req):
topics = Topic.objects.all()
categories = Category.objects.all()
- #REPLACE ALL BLANKS WITH %20
-
context = {
'topics': topics,