Skip to content

Commit

Permalink
Merge pull request #10 from gauthamzz/hint
Browse files Browse the repository at this point in the history
Hint section added
  • Loading branch information
gauthamzz authored Dec 20, 2016
2 parents 18fc2e8 + 46c4b49 commit d39a183
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.py~
*.sqlite*
wsgi/venv
wsgi/stegolica/stegolica/settings.py
67 changes: 56 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,61 @@
Python-Django based online event platform.
Python-Django based online event platform named stegolica

This was used as backend for [stegolica](http://stegolica.effe.org.in) 2016 part of [effervescence](http://eff.org.in)
> Hosting can be done at openshift and webapp is optimised for that.
You can reuse this code for any online event. Change the front end at wsgi/stegolica/templates/
# Features

Hosting can be done at openshift and webapp is optimised for that.
1. Question page with hint
2. Ranking page
3. Login and register page

use these commands to run
-----------------------
1. cd wsgi/stegolica
2. python manage.py runserver port(8000 is the default)
Frontend
--------
Uses [materializecss](http://materializecss.com/) and particle.js

About stegolica
---------------
Stegolica was an online stegnography competition. You can find all quesitons and answers at [my blog post](https://gauthamzz.github.io/2016/10/18/stegolica/)

New to this
----------
go to wsgi and create a virtualenv

`cd wsgi`
`virtualenv venv`
`source venv/bin/activate`

create a database

`createdb stegolica`

enable settings, fill in your username and password in settings.py

`cd stegolica`
`cp dev-settings.py settings.py`

Run it

`python manage.py runserver`

go to `127.0.0.1:8000` to view


> for deployment i openshift use dev.py.
Wanna help
---------
you can help by

1. finding out issues
2. fixing issues already in the issues section

Template design
--------------
## main page

![alt text](http://i.imgsafe.org/87195dec93.png)

## login page

![alt text](http://i.imgsafe.org/871922cf5d.png)

## Question page with hint

![alt text](http://i.imgsafe.org/879d151076.png)
File renamed without changes.
12 changes: 10 additions & 2 deletions wsgi/stegolica/templates/question.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@

</div>
</nav>
<!-- question 1 answer is "penpineappleapplepen" -->

<div class ="col-sm-9 col-sm-offset-2">
<div class ="col-sm-2 col-sm-offset-0">
<div class="card-panel hoverable grey lighten-4 ">
<h5>HINT</h5>
{{hint1}}
</div>
</div>



<div class ="col-sm-8 col-sm-offset-0">
<div class="card-panel hoverable grey lighten-4 ">
<h5>{{instance}}</h5>
{{imagelink|safe}}
Expand Down
25 changes: 25 additions & 0 deletions wsgi/stegolica/website/migrations/0009_auto_20161220_0533.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-20 00:03
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('website', '0008_auto_20161012_0013'),
]

operations = [
migrations.AlterField(
model_name='question',
name='hint1',
field=models.CharField(default='No Hints', max_length=300),
),
migrations.AlterField(
model_name='question',
name='imagelink',
field=models.CharField(default='No Image', max_length=300),
),
]
4 changes: 2 additions & 2 deletions wsgi/stegolica/website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class Question(models.Model):
questionid=models.AutoField(primary_key=True)
questiontext=models.CharField(max_length=100)
answertext=models.CharField(max_length=100)
hint1=models.CharField(max_length=100,default="No Hints")
imagelink=models.CharField(max_length=100,default="No Hints")
hint1=models.CharField(max_length=300,default="No Hints")
imagelink=models.CharField(max_length=300,default="No Image/Video")

def __unicode__(self):
return unicode(self.questionid)
Expand Down
8 changes: 3 additions & 5 deletions wsgi/stegolica/website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,10 @@ def question(request,id=None):
instance2=Ranking.objects.create(username=request.user.username,currentquestion=1)
if instance2.currentquestion!=id :
return HttpResponseRedirect("/website/%s" %instance2.currentquestion)
# check if user already ansered
# time=instance2.timestarted
# currenttime=datetime.datetime.now()
# diff=currenttime-time
instancetext=instance.questiontext
imagelink=instance.imagelink
answer=instance.answertext
hint1=instance.hint1
# check if answer is correct
if form.is_valid():
instance1=form.save(commit=False)
Expand All @@ -76,7 +73,8 @@ def question(request,id=None):
context={
"instance":instancetext,
"form":form,
"imagelink":imagelink
"imagelink":imagelink,
"hint1":hint1
# "differenceintime":diff
}
return render(request,"question.html",context)

0 comments on commit d39a183

Please sign in to comment.