Skip to content

Commit

Permalink
admin controls
Browse files Browse the repository at this point in the history
  • Loading branch information
vjdhama committed Feb 6, 2013
1 parent 27b2954 commit b144412
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 20 deletions.
1 change: 0 additions & 1 deletion index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ indexes:
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.

31 changes: 25 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import webapp2,os
import webapp2, os, string, random
import jinja2

from google.appengine.ext import db

jinja_environment = jinja2.Environment(autoescape=True,
loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')))
Expand All @@ -32,13 +32,32 @@ def render_str(self, template, **params):
def render(self, template, **kw):
self.write(self.render_str(template, **kw))

class Register(db.Model):
teamname = db.StringProperty(required = False)
password = db.StringProperty(required = True)
email = db.StringProperty(required = True)

class MainHandler(Handler):
def get(self):
#template = jinja_environment.get_template('base.html')
#self.response.out.write(template.render())
self.render("base.html")
#self.response.out.write('dawddwad')
def post(self):
self.render("base.html")

class RegisterHandler(Handler):
def make_pass(self):
return ''.join(random.choice(string.letters) for x in xrange(5))
def get(self):
self.render('reg.html')
def post(self):
team = self.request.get('team')
mail = self.request.get('email')
pasw = self.make_pass()
Regstr = Register(teamname = team,password = pasw,email = mail)
Regstr.put()
self.redirect('/')


app = webapp2.WSGIApplication([
('/', MainHandler)
('/', MainHandler),
('/admin/register', RegisterHandler)
], debug=True)
Binary file modified main.pyc
Binary file not shown.
24 changes: 19 additions & 5 deletions stylesheets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ body{
font-family: Verdana, Tahoma, sans-serif;
color : rgb(255,127,39);
background-color: rgb(88,88,88);
margin : 0 auto;
margin: 0 auto;
}
.header{
background-color: rgb(80,80,80);
text-align: left;
background-color: rgb(250,250,250);
font-size: 24px;
margin: 0;
height: 40px;
box-shadow: rgba(0,0,0,0.1) 0px 0px 20px;
}
.header div{
width: 200px;
font-weight: bold;
margin-left: 10px;
text-align: center;
margin-left: 41%;
}
.header div a{
color: rgb(255,127,39);
Expand Down Expand Up @@ -64,3 +64,17 @@ body{
font-size: 14px;
color: rgb(255,127,39);
border-radius: 5px;
}
.footer {
background-color: white;
height: 40px;
text-align: center;
font-size:10px;
color:#CC0000;
font-family:Verdana;
padding-top: 10px;
width: 100%;
position:fixed;
left: 0px;
bottom: 0px;
}
83 changes: 83 additions & 0 deletions stylesheets/ques.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
body{
font-family: Verdana, Tahoma, sans-serif;
color : rgb(255,127,39);
background-color: rgb(88,88,88);
margin: 0 auto;
}
.header{
background-color: rgb(250,250,250);
font-size: 24px;
height: 40px;
box-shadow: rgba(0,0,0,0.1) 0px 0px 20px;
}
.header div{
width: 200px;
font-weight: bold;
text-align: center;
margin-left: 41%;
}
.header div a{
color: rgb(255,127,39);
}
.login-box{
width: 70%;
font-family: inherit;
vertical-align: center;
margin-left: 15%;
border-color: white;
border-style:ridge;
border-bottom-right-radius: 20px;
border-top-left-radius: 20px;
margin-top: 10%;
box-shadow: 0px 0px 10px;
}
.login-box h3{
margin : 10px;
margin-bottom: 3px;
}
.login-box hr{
margin: 10px;
margin-top: 0;
}
.login-form{
margin-left: 25%;
margin-right: 30%;
}
.login-form input{
margin-left: 15px;
color: rgb(88,88,88);
padding: 5px;
border: solid 1px #E5E5E5;
box-shadow: rgba(0,0,0, 0.1) 0px 0px 10px;
}
.login-form input:hover,input:focus{
border-color: rgb(88,88,88);
}
.login-form p{
text-align: right;
}
.innerform{
display: inline;
}
.submit{
width: auto;
padding: 9px 15px;
background: white;
border: 0;
font-size: 14px;
color: rgb(255,127,39);
border-radius: 5px;
}
.footer {
background-color: white;
height: 40px;
text-align: center;
font-size:10px;
color:#CC0000;
font-family:Verdana;
padding-top: 10px;
width: 100%;
position:fixed;
left: 0px;
bottom: 0px;
}
80 changes: 80 additions & 0 deletions stylesheets/reg.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
body{
font-family: Verdana, Tahoma, sans-serif;
color : rgb(255,127,39);
background-color: rgb(88,88,88);
margin: 0 auto;
}
.header{
background-color: rgb(250,250,250);
font-size: 24px;
height: 40px;
box-shadow: rgba(0,0,0,0.1) 0px 0px 20px;
}
.header div{
width: 200px;
font-weight: bold;
text-align: center;
margin-left: 41%;
}
.header div a{
color: rgb(255,127,39);
}
.login-box{
width: 50%;
font-family: inherit;
vertical-align: center;
margin-left: 25%;
border-color: white;
border-style:ridge;
border-bottom-right-radius: 20px;
border-top-left-radius: 20px;
margin-top: 10%;
box-shadow: 0px 0px 10px;
}
.login-box h3{
margin : 10px;
margin-bottom: 3px;
}
.login-box hr{
margin: 10px;
margin-top: 0;
}
.login-form{
margin-left: 25%;
margin-right: 30%;
}
.login-form input{
margin-left: 15px;
color: rgb(88,88,88);
padding: 5px;
border: solid 1px #E5E5E5;
box-shadow: rgba(0,0,0, 0.1) 0px 0px 10px;
}
.login-form input:hover,input:focus{
border-color: rgb(88,88,88);
}
.login-form p{
text-align: right;
}
.submit{
width: auto;
padding: 9px 15px;
background: white;
border: 0;
font-size: 14px;
color: rgb(255,127,39);
border-radius: 5px;
}
.footer {
background-color: white;
height: 40px;
text-align: center;
font-size:10px;
color:#CC0000;
font-family:Verdana;
padding-top: 10px;
width: 100%;
position:fixed;
left: 0px;
bottom: 0px;
}
20 changes: 12 additions & 8 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="../stylesheets/base.css" />
<title>CodeRed</title>
<link type="text/css" rel="stylesheet" href="../stylesheets/base.css" />
<title>CodeRed</title>
</head>
<body>
<div class = 'header'>
<div><a href = '#'>CodeRed</a></div>
<div><a href = '#'><span style = 'color : rgb(88,88,88);'>Code</span>Red</a></div>
</div>
<div class = "login-box">
<h3>CodeRed Login</h3>
<hr>
<form class = 'login-form'>
<p>Username
<input type = 'text' placeholder = 'Username'>
<form method = 'post' class = 'login-form'>
<p>Teamname
<input type = 'text' placeholder = 'Enter Team name'>
</p>
<p>Password
<input type = 'password' placeholder = 'Password'>
<input type = 'password' placeholder = 'Enter Password'>
</p>
<p>
<input class = 'submit' type = 'submit'>
<input class = 'submit' type = 'submit' value = 'Login'>
</p>
</form>
</div>
</body>
<footer class = 'footer'>
<img src="https://developers.google.com/appengine/images/appengine-noborder-120x30.gif"
alt="Powered by Google App Engine" />
</footer>
</html>
46 changes: 46 additions & 0 deletions templates/ques.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="../stylesheets/ques.css" />
<title>CodeRed</title>
</head>
<body>
<div class = 'header'>
<div><a href = '#'><span style = 'color : rgb(88,88,88);'>Code</span>Red</a></div>
</div>
<div class = "login-box">
<h3>CodeRed Login</h3>
<hr>
<form method = 'post' class = 'login-form'>
<div class = 'innerform'>
<div>
<p>Question
<textarea placeholder = 'Enter Question'></textarea>
</p>
</div>
<div>
<p>Choice 1
<input type = 'text' placeholder = 'Enter Choice 1'>
</p>
<p>Choice 2
<input type = 'text' placeholder = 'Enter Choice 2'>
</p>
<p>Choice 3
<input type = 'text' placeholder = 'Enter Choice 3'>
</p>
<p>Choice 4
<input type = 'text' placeholder = 'Enter Choice 4'>
</p>
<p>
<input class = 'submit' type = 'submit'>
</p>
</div>
</div>
</form>
</div>
</body>
<footer class = 'footer'>
<img src="https://developers.google.com/appengine/images/appengine-noborder-120x30.gif"
alt="Powered by Google App Engine" />
</footer>
</html>
31 changes: 31 additions & 0 deletions templates/reg.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="../stylesheets/reg.css" />
<title>CodeRed</title>
</head>
<body>
<div class = 'header'>
<div><a href = '#'>CodeRed</a></div>
</div>
<div class = "login-box">
<h3>CodeRed Register</h3>
<hr>
<form method = 'post' class = 'login-form'>
<p>Teamname
<input type = 'text' name = 'team' placeholder = 'Enter teamname'>
</p>
<p>Email
<input type = 'text' name = 'email' placeholder = 'Enter email'>
</p>
<p>
<input class = 'submit' type = 'submit' value = 'Register'>
</p>
</form>
</div>
</body>
<footer class = 'footer'>
<img src="https://developers.google.com/appengine/images/appengine-noborder-120x30.gif"
alt="Powered by Google App Engine" />
</footer>
</html>

0 comments on commit b144412

Please sign in to comment.