forked from beltiras/vaa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Árni St. Sigurðsson
committed
Jul 8, 2016
0 parents
commit d6c0b48
Showing
56 changed files
with
1,293 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vaa.settings") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Django==1.9.7 | ||
Pillow==3.3.0 | ||
argparse==1.2.1 | ||
backports.shutil-get-terminal-size==1.0.0 | ||
crc16==0.1.1 | ||
decorator==4.0.10 | ||
django-crispy-forms==1.6.0 | ||
ipython==4.2.1 | ||
ipython-genutils==0.1.0 | ||
pathlib2==2.1.0 | ||
pexpect==4.2.0 | ||
pickleshare==0.7.2 | ||
psycopg2==2.6.1 | ||
ptyprocess==0.5.1 | ||
python-redis==0.0.7 | ||
simplegeneric==0.8.1 | ||
six==1.10.0 | ||
traitlets==4.2.2 | ||
wsgiref==0.1.2 | ||
git+https://github.com/timmyomahony/django-charsleft-widget.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.charsleft{ | ||
height: 23px; | ||
} | ||
.charsleft > span{ | ||
vertical-align: middle; | ||
margin-left: 0.5em; | ||
color: #ccc; | ||
line-height: 23px; | ||
} | ||
.charsleft span .count{ | ||
color: #333; | ||
} | ||
.charsleft .maxlength{ | ||
display: none; | ||
} | ||
.charsleft span .orange{color:#EA1300 !important;} | ||
.charsleft span .red{color: #D56F24 !important;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(function($){ | ||
|
||
$.fn.charsLeft = function(options){ | ||
|
||
var defaults = { | ||
'source':'input', | ||
'dest':'.count', | ||
} | ||
var options = $.extend(defaults, options); | ||
|
||
var calculate = function(source, dest, maxlength){ | ||
var remaining = maxlength - source.val().length; | ||
dest.html(remaining); | ||
/* Over 50%, change colour to orange */ | ||
p=(100*remaining)/maxlength; | ||
console.log(p) | ||
if(p<25){ | ||
dest.addClass('orange'); | ||
}else if(p<50){ | ||
dest.addClass('red'); | ||
}else{ | ||
dest.removeClass('orange red'); | ||
} | ||
}; | ||
|
||
this.each(function(i, el) { | ||
var maxlength = $(this).find('.maxlength').html(); | ||
var dest = $(this).find(options.dest); | ||
var source = $(this).find(options.source); | ||
source.keyup(function(){ | ||
calculate(source, dest, maxlength) | ||
}); | ||
source.change(function(){ | ||
calculate(source, dest, maxlength) | ||
}); | ||
}); | ||
}; | ||
$(function() { // Added page ready wrapper | ||
$(".charsleft-input").charsLeft({ | ||
'source':'input', | ||
'dest':".count", | ||
}); | ||
}); | ||
})(jQuery); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(function($){ | ||
|
||
$.fn.charsLeft = function(options){ | ||
|
||
var defaults = { | ||
'source':'input', | ||
'dest':'.count', | ||
} | ||
var options = $.extend(defaults, options); | ||
|
||
var calculate = function(source, dest, maxlength){ | ||
var remaining = maxlength - source.val().length; | ||
dest.html(remaining); | ||
/* Over 50%, change colour to orange */ | ||
p=(100*remaining)/maxlength; | ||
console.log(p) | ||
if(p<25){ | ||
dest.addClass('orange'); | ||
}else if(p<50){ | ||
dest.addClass('red'); | ||
}else{ | ||
dest.removeClass('orange red'); | ||
} | ||
}; | ||
|
||
this.each(function(i, el) { | ||
var maxlength = $(this).find('.maxlength').html(); | ||
var dest = $(this).find(options.dest); | ||
var source = $(this).find(options.source); | ||
source.keyup(function(){ | ||
calculate(source, dest, maxlength) | ||
}); | ||
source.change(function(){ | ||
calculate(source, dest, maxlength) | ||
}); | ||
}); | ||
}; | ||
$(function() { // Added page ready wrapper | ||
$(".charsleft-input").charsLeft({ | ||
'source':'input', | ||
'dest':".count", | ||
}); | ||
}); | ||
})(django.jQuery); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head> | ||
<title>{% block title %}{% endblock title %}</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> | ||
{% block extrahead %} | ||
{% endblock extrahead %} | ||
</head> | ||
<body> | ||
{% block content %} | ||
{% endblock content %} | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<title>{% block title %}{% endblock title %}</title> | ||
</head> | ||
<body> | ||
{% block content %} | ||
{% endblock content %} | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% extends "base.html" %} | ||
{% load crispy_forms_tags %} | ||
{% block content %} | ||
{% crispy answerform %} | ||
{{ answerform.media }} | ||
{% endblock content %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% extends "base.html" %} | ||
{% crispy answerform %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<table> | ||
<thead> | ||
<tr><td>Frambjóðandi</td><td>Hversu sammála</td></tr> | ||
</thead> | ||
<tbody> | ||
{% for cand, percent in data %} | ||
<tr><td>{{ cand.name }}</td><td>{{ percent }}</td> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
|
||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% extends "base.html" %} | ||
{% load crispy_forms_tags %} | ||
{% block content %} | ||
<form action="/userupdate/" method="POST"> | ||
{% crispy userpageform %} | ||
</form> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
{{ userform.as_p }} | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% extends "base.html" %} | ||
{% load crispy_forms_tags %} | ||
{% block content %} | ||
{% crispy voterform %} | ||
{% endblock content %} |
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Candidate, Question, QuestionText, AnswerSheet, AnswerText | ||
|
||
|
||
class QuestionTextInline(admin.TabularInline): | ||
model = QuestionText | ||
|
||
|
||
class AnswerSheetInline(admin.TabularInline): | ||
model = AnswerSheet | ||
|
||
|
||
class CandidateAdmin(admin.ModelAdmin): | ||
inlines = [AnswerSheetInline,] | ||
|
||
|
||
class QuestionAdmin(admin.ModelAdmin): | ||
inlines = [QuestionTextInline,] | ||
|
||
|
||
class AnswerSheetAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
|
||
class AnswerTextAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
admin.site.register(Candidate, CandidateAdmin) | ||
admin.site.register(Question, QuestionAdmin) | ||
admin.site.register(AnswerSheet, AnswerSheetAdmin) | ||
admin.site.register(AnswerText, AnswerTextAdmin) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Candidate, Question, QuestionText, AnswerSheet | ||
|
||
|
||
class QuestionTextInline(admin.TabularInline): | ||
model = QuestionText | ||
|
||
|
||
class AnswerSheetInline(admin.TabularInline): | ||
model = AnswerSheet | ||
|
||
|
||
class CandidateAdmin(admin.ModelAdmin): | ||
inlines = [AnswerSheetInline,] | ||
|
||
|
||
class QuestionAdmin(admin.ModelAdmin): | ||
inlines = [QuestionTextInline,] | ||
|
||
|
||
class AnswerSheetAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
|
||
admin.site.register(Candidate, CandidateAdmin) | ||
admin.site.register(Question, QuestionAdmin) | ||
admin.site.register(AnswerSheet, AnswerSheetAdmin) |
Oops, something went wrong.