prevent samefagging, show user votes on pageload, add todo list
This commit is contained in:
parent
a485a36897
commit
1652b23590
|
@ -11,6 +11,7 @@ import types
|
|||
import random
|
||||
|
||||
import bleach
|
||||
from django.db import IntegrityError
|
||||
from django.utils.timezone import localtime
|
||||
|
||||
from quest.models import *
|
||||
|
@ -341,12 +342,15 @@ def vote(socket, data):
|
|||
)
|
||||
if user.username:
|
||||
v.user = user
|
||||
v.save()
|
||||
try:
|
||||
v.save()
|
||||
except IntegrityError: # shouldn't we check this first?
|
||||
return
|
||||
|
||||
data = {}
|
||||
data['option_id'] = option_id
|
||||
data['polarity'] = polarity
|
||||
socket.send('vote', data)
|
||||
data = {}
|
||||
data['option_id'] = option_id
|
||||
data['polarity'] = polarity
|
||||
socket.send('vote', data)
|
||||
|
||||
|
||||
events = {}
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
{% for option in poll_options.filter(poll=post.poll).order_by("id") %}
|
||||
<tr id="optionRow-{{ option.id }}">
|
||||
<td class="pollCheckBox">
|
||||
<input type="checkbox" {# if ip_address in poll_votes.get(option.id) %}checked="true"{% endif #} id="pollInput-{{ option.id }}" onchange="vote({{ post.id }}, {{ option.id }})"{% if not post.poll.open %} disabled{% endif %}/>
|
||||
<input type="checkbox" {% if poll_votes.filter(option=option, ip_address=ip_address) %}checked="true"{% endif %} id="pollInput-{{ option.id }}" onchange="vote({{ post.id }}, {{ option.id }})"{% if not post.poll.open %} disabled{% endif %}/>
|
||||
<label for="pollInput-{{ option.id }}"></label>
|
||||
</td>
|
||||
<td class="option_text">{{ option.text }}</td>
|
||||
|
|
17
quest/migrations/0012_auto_20180904_0732.py
Normal file
17
quest/migrations/0012_auto_20180904_0732.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.1 on 2018-09-04 11:32
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('quest', '0011_auto_20180902_2007'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterUniqueTogether(
|
||||
name='pollvote',
|
||||
unique_together={('option', 'ip_address')},
|
||||
),
|
||||
]
|
|
@ -126,6 +126,9 @@ class PollVote(models.Model):
|
|||
null=True)
|
||||
ip_address = models.GenericIPAddressField()
|
||||
|
||||
class Meta:
|
||||
unique_together = ('option', 'ip_address')
|
||||
|
||||
|
||||
class PageTitle(models.Model):
|
||||
"""
|
||||
|
|
|
@ -140,6 +140,14 @@ function vote(post_id, option_id) {
|
|||
let polarity = document.getElementById('pollInput-' + option_id).checked;
|
||||
socket.send('vote', {post_id: post_id, option_id: option_id, polarity: polarity, quest_id: quest_id});
|
||||
}
|
||||
function submitWritein(post_id) {
|
||||
let writeinInput = document.getElementById('writeinInput');
|
||||
if (!writeinInput) { return; }
|
||||
let option_text = writeinInput.value;
|
||||
writeinInput.value = '';
|
||||
if (!option_text) { return; }
|
||||
socket.emit('write_in', {option_text: option_text, post_id: post_id, room: room_id});
|
||||
}
|
||||
|
||||
/* Helpers */
|
||||
function padToTwo(number) {
|
||||
|
|
34
todo
Normal file
34
todo
Normal file
|
@ -0,0 +1,34 @@
|
|||
New Features:
|
||||
Pages/appendixes
|
||||
Live indicator/countdown
|
||||
Notifications
|
||||
Anonymous names
|
||||
Banner images
|
||||
Search page
|
||||
Front page to show new quests
|
||||
Webm posting
|
||||
(you) counter
|
||||
Enable namefagging
|
||||
Account managament/logout
|
||||
Display profile link in header bar
|
||||
Tagging system
|
||||
Quote backlinks
|
||||
Make chat hideable
|
||||
|
||||
Improvements:
|
||||
Revamp post editing
|
||||
More options for text posts (lists and so on)
|
||||
More rigorous input checking in events.py
|
||||
New post displays chat message
|
||||
Record email on signup
|
||||
Change urls
|
||||
Poll vote highlights entire option
|
||||
Poll vote doesn't disappear checkbox
|
||||
Total voters per poll
|
||||
Chat archives
|
||||
Only last 100 (50?) chat messages are loaded on page load
|
||||
Adjust quote preview postioning
|
||||
|
||||
Port from old code:
|
||||
Edit post
|
||||
Writein
|
Loading…
Reference in New Issue
Block a user