-
{% block title %}Passwords{% endblock %}
diff --git a/web/admin.py b/web/admin.py
index ac8ff2a..2d915f9 100644
--- a/web/admin.py
+++ b/web/admin.py
@@ -1,4 +1,5 @@
-from web.models import Password
+from web.models import *
from django.contrib import admin
-admin.site.register(Password)
\ No newline at end of file
+admin.site.register(Source)
+admin.site.register(Password)
diff --git a/web/admin.pyc b/web/admin.pyc
index dda84f67f68a307ccb2c7097ad2c788cb2c941fa..e039ccef762b7cf185efd270a0af4c0042dfc4f6 100644
GIT binary patch
delta 197
zcmdnObcU(^;wN6N)s{xS$qZ1y0;C;)xY!OzqyP~kLpB3L2#CeRkj==D!^9B9#K4%!
z#E{9%kjcW3%F58ph|FgL^HZ1^f;B*9W&Q^O4MrfV1Vm^-n5;l%VoGkNSe~B-J4lWT
zNR+20>E-69q~;V)oUSKP!Uhxy&Mz%WPA%a8G6NEei_7ziQYIcv=K@J_F$ypVFaiML
CvL<5y
delta 172
zcmX@Zw1uhu;wN6NI2j|~WCkc;0n!dYTxnMGX!gZOvwBX1R9J$RtX1?2uLh0F3&GYfrzjIMG{kT
qGxPj3B-lVoxPU}?YLZ@VeoAUiaS)KlFmbBh#M|i{AhQG*1(*PXsvztD
diff --git a/web/models.py b/web/models.py
index 12bf458..552a292 100644
--- a/web/models.py
+++ b/web/models.py
@@ -1,6 +1,12 @@
from django.db import models
+class Source(models.Model):
+ name = models.CharField(max_length = 255)
+ def __unicode__(self):
+ return self.name
+
class Password(models.Model):
- password = models.CharField(max_length = 255)
+ password = models.CharField(max_length = 1000)
+ Source = models.ForeignKey(Source)
def __unicode__(self):
- return self.password
\ No newline at end of file
+ return self.password + " from " + self.Source.name
\ No newline at end of file
diff --git a/web/models.pyc b/web/models.pyc
index 0568c8e9aeb99736919b595558ebc62ea443b9ad..2df56ef0b9dd26868db65a2bcf04f05e00303594 100644
GIT binary patch
delta 381
zcmXX?!AiqG6r8thk|rXGpry26FT&o0-n^(F^dc>|Ihl)=WGg}1NKz58;GzCN$X9q0
zKgGZB?9H3+EiTO4+1dAIhyC#Cu>bY59o?RcCMo_`oA+}@HLm-|153yi=7h|{8?XVc
zlQuFRu@34uFE*{I&*5yk_W|y;t{rnwLZ4X~Ze6~PBunKt#8ITd15POK?!TQ(`
z5+9io|0IBkb&JQ0;*x(eO^KO6lnX|+&t=WG&aErVrR>I9TBenR8qUi?FNV%*)nVab
zR#i_$nHjM%@`QFwGB*KTof(hW7NZgukd`SUUM7&jfN@&HY$at}ls3OxUfO3v%{$#3
ege*#ni{R59?a)+v%|IO~6E>&n-hI)o>Un?R^Eoj9
delta 111
zcmbQpxt>+};wN6Nl-<$qZ1y0;C;)xL9|hw7zt(1}l)A`5y>07=f%3HXxCkpOTtW
zJXwcHe&Xy*9uA;LL1J-nd45sKW*$ZbMrJ<^mdW3lRVN=|44YieBE-f7R3X3w0P_SJ
A9RL6T
diff --git a/web/views.py b/web/views.py
index f73adc8..9ee6f56 100644
--- a/web/views.py
+++ b/web/views.py
@@ -6,21 +6,18 @@
def index(request):
- # I don't really like .reverse()[:5] part but it will have to do for now
- pass_count = Password.objects.all().count()
- return render_to_response('web/index.html', {'pass_count': pass_count},
+ return render_to_response('web/index.html', {'pass_count': Password.objects.all().count()},
context_instance=RequestContext(request))
def add(request):
# This here is some really primitive error handling:
- # I would use trim() but there is probably someone out there with a password containing only spaces :)
-
+ # I would use trim() but there is probably someone out there with a password containing only spaces :)
if(request.method != "POST" or len(request.POST['pw_pass']) == 0):
return HttpResponseBadRequest("You have made a nono, go back.")
- #if(request.POST["cb_add"] == "on"):
- p = Password(password=request.POST["pw_pass"])
+ # Source_id should not be hardcoded but it's late:
+ p = Password(password=request.POST["pw_pass"], Source_id=1)
p.save()
return HttpResponseRedirect('/id/' + str(p.id))
diff --git a/web/views.pyc b/web/views.pyc
index 37d796ca001cc085d629cff7807e967b9461b130..56a36e49884d787e8ca1d784ea57725746a1fd02 100644
GIT binary patch
delta 260
zcmdnRbBu@W;wN6NBi0+)xEZw>85kJYfY=#`i}is-2?Ik4BSQuwLkS~8CKE#@Gea{2
zLnaH5ob1FH!N@py8l$=>6HuWBNNWi@kSIzmEKMygnS6&aUYZ5SXJArdOa{q_EeqY8e@7fHts#jAtwXigJJq0|{|3G&3@Y197kh=j4-2al$2>
zKr@2#ON)|I<1C}y3=9lxK