Skip to content

Commit

Permalink
Revert "solved conflicts -_-"
Browse files Browse the repository at this point in the history
This reverts commit dbc3f82, reversing
changes made to 8018358.
  • Loading branch information
kunaaljain committed Apr 6, 2015
1 parent dbc3f82 commit 75703ab
Show file tree
Hide file tree
Showing 140 changed files with 31 additions and 49,632 deletions.
Binary file removed db.sqlite3
Binary file not shown.
8 changes: 3 additions & 5 deletions gems/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@
STATIC_URL = '/static/'

STATICFILES_DIRS = (
os.path.join(BASE_DIR,"mainSite/static/"),
os.path.join(BASE_DIR, "static"),
os.path.join(BASE_DIR, "static"),
'/var/www/static/',
)

)

# auth
LOGIN_URL = '/gems/login'
LOGIN_URL = '/gems/login'
1 change: 0 additions & 1 deletion gems/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
# url(r'^$', 'gems.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^mainsite/' , include('mainSite.urls')) ,
url(r'^gems/', include('mainSite.urls')),
)
4 changes: 1 addition & 3 deletions mainSite/admin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from django.contrib import admin
from mainSite.models import *
from models import *

# Register your models here.
admin.site.register(Users)
admin.site.register(Candidates)
admin.site.register(Votes)
admin.site.register(PublicKeys)
admin.site.register(ChallengeStrings)
admin.site.register(Posts)
admin.site.register(PublicKeys)
admin.site.register(New_Candidate)
47 changes: 6 additions & 41 deletions mainSite/databaseManager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
import sys
import json
from django.contrib.auth.models import User
from .models import User, Candidates,Votes, PublicKeys, ChallengeStrings ,Posts
from Crypto.PublicKey import RSA
from django.contrib.auth.models import User

from models import Users, Candidates,Votes, PublicKeys, ChallengeStrings
import cryptography

def registerUsers(userList):
Expand Down Expand Up @@ -44,6 +45,7 @@ def addUser(username, department, name, course, password, voted=False):
#generate private key
key = RSA.generate(2048)
encryptedPrivateKey = cryptography.symmetricEncrypt(key.exportKey(), password)

p1 = Users(username=username, voted=voted, department=department, name=name, course=course, encryptedPrivateKey=encryptedPrivateKey)
p1.save()
return key.publickey().exportKey()
Expand Down Expand Up @@ -160,48 +162,11 @@ def importElectionData(src):
stats = {'':''}
return stats
#------------------------

def getPosts():
postList = Posts.objects.all()
postDetailsList = []
for post in postList :
print(post.postName)
#postDetails{'postName':post.postName,'postCount':post.postCount,'voterGender':post.voterGender,'voterCourse':post.voterCourse}
postDetails = post.postName,post.postCount,post.voterGender,post.voterCourse
postDetailsList.append(postDetails)
return postDetailsList

#--------------------------

def addPost(postName,postCount,voterGender,voterCourse):
p = Posts(postName=postName,voterGender=voterGender,voterCourse=voterCourse)
p.save()
return True

#---------------------------

def getCandidatesList():
candidatesObj = Candidates.objects.all()
candidatesList = []
for item in candidatesObj :
candidateTuple = (item.username,item.details,item.photo,item.approved)
candidatesList.append(candidateTuple)
print(candidateTuple)

return candidatesList

#-----------------------------

#def getEligiblility(post):



#def isEligible(candidate,post):

def verifyVote(votes):
"""Verifies all votes"""
for vote in votes:
value = cryptography.asymmetricVerify(vote.plainText, vote.certificate, vote.publicKey.publicKey)
if value == False:
print(error)
print error
return value
return value
14 changes: 0 additions & 14 deletions mainSite/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Candidates(models.Model):
details = models.CharField(max_length=10000)
photo = models.CharField(max_length=100)
approved = models.BooleanField()

def __unicode__(self):
return self.username

Expand All @@ -40,19 +39,6 @@ class ChallengeStrings(models.Model):
class PublicKeys(models.Model):
publicKey = models.CharField(max_length=2048)


# more fields to be added

class Posts(models.Model):
postName = models.CharField(max_length=50)
postCount = models.IntegerField(max_length=3)
voterGender = models.CharField(max_length=1) #'M'/'F'/'any'
voterCourse = models.CharField(max_length=2) # 'UG'/'PG'/'any'
eligibleGender = models.CharField(max_length=1) #'M'/'F'/'any'
eligibleCourse = models.CharField(max_length=2) #'UG'/"PG"/'any'
eligibleYear = models.CharField(max_length=2) #minimum requirement of year


class New_Candidate(models.Model):
name = models.CharField(max_length=50)
post = models.CharField(max_length=4 ,default='')
Expand Down
22 changes: 0 additions & 22 deletions mainSite/sdfs

This file was deleted.

202 changes: 0 additions & 202 deletions mainSite/static/LICENSE

This file was deleted.

26 changes: 0 additions & 26 deletions mainSite/static/README.md

This file was deleted.

Loading

0 comments on commit 75703ab

Please sign in to comment.