diff --git a/homepage/jinja2/homepage/index.html b/homepage/jinja2/homepage/index.html
index db2950e..85dfddc 100644
--- a/homepage/jinja2/homepage/index.html
+++ b/homepage/jinja2/homepage/index.html
@@ -5,7 +5,7 @@
{% endblock %}
{% block content %}
diff --git a/quest/migrations/0006_quest_anonymize.py b/quest/migrations/0006_quest_anonymize.py
new file mode 100644
index 0000000..ce6f9ce
--- /dev/null
+++ b/quest/migrations/0006_quest_anonymize.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.1 on 2018-10-03 16:53
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('quest', '0005_auto_20181003_1217'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='quest',
+ name='anonymize',
+ field=models.BooleanField(default=True),
+ ),
+ ]
diff --git a/quest/models.py b/quest/models.py
index 3506df8..b9c0d09 100644
--- a/quest/models.py
+++ b/quest/models.py
@@ -19,6 +19,7 @@ class Quest(models.Model):
live = models.BooleanField()
live_time = models.DateTimeField(blank=True, null=True)
tags = TaggableManager()
+ anonymize = models.BooleanField(default=True)
class Message(models.Model):
diff --git a/quest/static/quest.js b/quest/static/quest.js
index 74cbefa..e8c86a4 100644
--- a/quest/static/quest.js
+++ b/quest/static/quest.js
@@ -50,7 +50,7 @@ function load() {
/* Websocket receive */
socket.events['message'] = function(data) {
let msg_str = '
';
- msg_str = '
';
diff --git a/quest/views.py b/quest/views.py
index 5fb1d8d..1771658 100644
--- a/quest/views.py
+++ b/quest/views.py
@@ -15,22 +15,20 @@ from user.models import User
def index(request):
"""The quest page index."""
- if request.GET:
- author = request.GET.get('author')
- title = request.GET.get('title')
- tags = request.GET.get('tags')
- if not any((author, title, tags)):
- return
+ author = request.GET.get('author')
+ title = request.GET.get('title')
+ tags = request.GET.get('tags')
+
+ results = Quest.objects.all()
+ if author:
+ results = results.filter(
+ owner__username__unaccent__icontains=author)
+ if title:
+ results = results.filter(title__unaccent__icontains=title)
+ if tags:
+ results = results.filter(tags__name__in=tags.split())
+ results = results.distinct().order_by('-id')
- results = Quest.objects.all()
- if author:
- results = results.filter(
- owner__username__unaccent__icontains=author)
- if title:
- results = results.filter(title__unaccent__icontains=title)
- if tags:
- results = results.filter(tags__name__in=tags.split())
- results = results.distinct()
context = locals()
return render(request, 'quest/index.html', context)
diff --git a/titivillus/urls.py b/titivillus/urls.py
index 4f4a25d..b7c3e40 100644
--- a/titivillus/urls.py
+++ b/titivillus/urls.py
@@ -14,5 +14,4 @@ urlpatterns = [
path('login/', include('login.urls')),
path('logout/', include('logout.urls')),
path('user/', include('user.urls')),
- path('search/', include('search.urls')),
]
diff --git a/user/migrations/0002_user_anonymize.py b/user/migrations/0002_user_anonymize.py
new file mode 100644
index 0000000..fe93794
--- /dev/null
+++ b/user/migrations/0002_user_anonymize.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.1 on 2018-10-03 16:51
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('user', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='user',
+ name='anonymize',
+ field=models.BooleanField(default=True, help_text="Let's be honest, your name doesn't add anything to the conversation."),
+ ),
+ ]
diff --git a/user/models.py b/user/models.py
index 90a3f61..e47b15e 100644
--- a/user/models.py
+++ b/user/models.py
@@ -40,6 +40,11 @@ class User(AbstractUser):
first_name = None
last_name = None
email = models.EmailField('email address')
+ anonymize = models.BooleanField(
+ default=True,
+ help_text="Let's be honest, your name doesn't add anything to " \
+ + "the conversation."
+ )
def get_full_name(self):
return None