Skip to content

Commit

Permalink
validation added to upload_file route
Browse files Browse the repository at this point in the history
  • Loading branch information
jonager committed Sep 3, 2017
2 parents c8de190 + 2a9d392 commit 2bc866d
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 145 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ __pycache__/
*.py[cod]
*$py.class

#VC Code
.vscode

# C extensions
*.so

Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"python.pythonPath": "/Users/lolaruggamuffin/miniconda3/envs/flask-env/bin/python",
"python.pythonPath": "C:/Users/Cortana/AppData/Local/conda/conda/envs/flask-env/python",
"python.linting.pylintEnabled": false
}
211 changes: 119 additions & 92 deletions main.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/attendance.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block content %}
<div class="container">
{% if attendance|length == 0 %}
<div class="card small hoverable m6 lc-blue-text" id="att-date-card">
<div class="card large lc-blue-text" id="att-date-card">
<div class="card-content">
<span class="card-title">Attendance Dates</span>
<form action="/attendance" method="post">
Expand Down
98 changes: 52 additions & 46 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
}
main {
flex: 1 0 auto;
background-image: url('https://www.launchcode.org/assets/cover_banner_blue-8152795f6794e4bbb9fae2a63ad5bb01.jpg');
background-position: center center;
background-image: url('https://www.launchcode.org/assets/{{ bg_image }}');
background-position: center -50px;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
Expand All @@ -39,42 +39,52 @@
nav .brand-logo{
font-size: 1.75rem;
}
nav li a{
font-weight: 700;
text-transform: uppercase;
}
.dropdown-content li>span{
color: #344A5F !important;
}
.dropdown-content li>span:hover{
background-color: rgba(92, 147, 206,.2);
}
.dropdown-content li>a{
color: rgba(255,255,255,.9);
color: white !important;
}
.dropdown-content li>a:hover{
background-color: #F0400F !important;
}
.dropdown-content{
min-width: 165px;
min-width: 190px;
}
.page-footer .footer-copyright{
background-color: rgba(51,51,51,0.1) !important;
}
#teacher-card{
margin: 3rem -1.5rem 3rem -1.5rem;
height: 550px;
margin: 3rem 0;
height: auto;
}
#teacher{
width: 50%;
width: 40%;
}
#student-card{
margin: 8rem 0 8rem 0;
height: 325px;
margin: 6rem 0;
height: auto;
}
#student{
width: 30%;
width: 20%;
}
#change-card{
margin: 6rem 0 6rem 0;
height: 425px;
margin: 6rem 0;
height: auto;
}
#change{
width: 30%;
width: 20%;
}
#att-date-card{
margin: 6rem 0 6rem 0;
height: 425px;
margin: 2rem 0;
height: auto;
}
#index{
margin: 12rem 0 12rem 0;
Expand All @@ -88,6 +98,12 @@
font-size: 1.25rem;
letter-spacing: 1px;
}
.error{
background-color: #F0400F !important;
}
.info{
background-color: seagreen !important;
}
.btn{
background-color: #F47753 !important;
}
Expand All @@ -97,17 +113,20 @@
.lc-blue-text{
color: #344A5F !important;
}
nav li a.lc-blue-text:hover{
color: #5C93CE !important;
}
.lc-blue{
background-color: #344A5F;
background-color: #344A5F !important;
}
.lc-light-blue{
background-color: #5C93CE;
background-color: #5C93CE !important;
}
.lc-orange{
background-color: #F0400F;
background-color: #F0400F !important;
}
.lc-light-orange{
background-color: #F47753;
background-color: #F47753 !important;
}
</style>
<script>
Expand All @@ -121,9 +140,9 @@
// Initialize options
$('select').material_select();
// Flash Messages Toasts
{% with messages = get_flashed_messages() %}
{% for message in messages %}
Materialize.toast('{{ message }}', 4000);
{% with messages = get_flashed_messages(with_categories=True) %}
{% for class, message in messages %}
Materialize.toast('{{ message }}', 4000, '{{ class }}');
{% endfor %}
{% endwith %}
});
Expand All @@ -134,10 +153,10 @@
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper white">
<a href="/" class="brand-logo center lc-blue-text">LaunchCode <img src="https://www.launchcode.org/assets/launchcode-7e70c69adb4c3c1aa6d5aa15eba45fac.ico" alt="LC"> Attendance</a>
<a href="/" class="brand-logo center lc-blue-text">LaunchCode Attendance</a>
{% if session['email'] %}
<ul class="left">
<li><a class="dropdown-button waves-effect waves-light lc-blue-text" href="#!" data-activates="dropdown"><i class="material-icons">menu</i></a></li>
<li><a class="dropdown-button waves-effect waves-light lc-blue-text" href="#!" data-activates="dropdown"><i class="material-icons">menu</i></a></li>
</ul>
<a href="#" data-activates="mobile-demo" class="button"></a>
<ul class="dropdown-content lc-light-orange" id="dropdown">
Expand All @@ -161,32 +180,19 @@
<footer class="page-footer lc-blue">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h5 class="white-text">LaunchCode Attendance</h5>
<p class="grey-text text-lighten-4">Tracks Attendance for LC101 Cohorts.</p>
</div>
<div class="col l4 offset-l1 s12">
<h5 class="white-text">Contributors</h5>
<div class="col">
<div class="row">
<a class="chip lc-light-blue-text" href="https://github.com/anthony-becerra" target='_blank'><img src="https://avatars2.githubusercontent.com/u/27900121?v=4&s=400" alt="Anthony Img">Anthony</a>
<a class="chip lc-light-blue-text" href="https://github.com/dannyneira" target='_blank'><img src="https://avatars2.githubusercontent.com/u/16809145?v=4&s=460" alt="Danny Img">Danny</a>
</div>
</div>
<div class="col">
<div class="row">
<a class="chip lc-light-blue-text" href="https://github.com/kitiarasr" target='_blank'><img src="https://avatars3.githubusercontent.com/u/14181911?v=4&s=400" alt="Kitiara Img">Kitiara</a>
<a class="chip lc-light-blue-text" href="https://github.com/jonager" target='_blank'><img src="https://avatars0.githubusercontent.com/u/17533132?v=4&s=400" alt="Jonathan Img">Jonathan</a>
</div>
<div class="fixed-action-btn horizontal">
<a href='https://github.com/anthony-becerra/launchcode-attendance' target='_blank' class="btn-floating hoverable btn-large lc-light-blue"><i class='ion-social-github'></i></a>
<ul>
<li><a class="chip hoverable lc-blue-text" href="https://github.com/anthony-becerra" target='_blank'><img src="https://avatars2.githubusercontent.com/u/27900121?v=4&s=400" alt="Anthony Img">Anthony</a></li>
<li><a class="chip hoverable lc-blue-text" href="https://github.com/dannyneira" target='_blank'><img src="https://avatars2.githubusercontent.com/u/16809145?v=4&s=460" alt="Danny Img">Danny</a></li>
<li><a class="chip hoverable lc-blue-text" href="https://github.com/kitiarasr" target='_blank'><img src="https://avatars3.githubusercontent.com/u/14181911?v=4&s=400" alt="Kitiara Img">Kitiara</a></a></li>
<li><a class="chip hoverable lc-blue-text" href="https://github.com/jonager" target='_blank'><img src="https://avatars0.githubusercontent.com/u/17533132?v=4&s=400" alt="Jonathan Img">Jonathan</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
© 2017 Copyright
<a class="grey-text text-lighten-3 right" href='https://github.com/anthony-becerra/launchcode-attendance' target='_blank'>Fork us on Github! <i class='ion-social-github'></i></a>
</div>
<div class="container">© 2017 Copyright</div>
</div>
</footer>
</body>
Expand Down
2 changes: 1 addition & 1 deletion templates/change_pin.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</div>
</div>
<div class="row">
<button class="btn waves-effect waves-light lc-orange right" type="submit" name="action">Change Pin</button>
<button class="btn waves-effect waves-light lc-light-orange right" type="submit" name="action">Change Pin</button>
</div>
</form>
</div>
Expand Down
4 changes: 4 additions & 0 deletions templates/edit_student.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ <h2>Edit Student</h2>
<input type="submit" value="Save Changes">
</form>

<<<<<<< HEAD
<!-- Adds all the cohorts students at once into the student table
only accepts .xlsx files -->
<form action = "/upload_file" method = "POST" enctype = "multipart/form-data">
Expand All @@ -50,3 +51,6 @@ <h2>Edit Student</h2>

{% endblock %}

=======
{% endblock %}
>>>>>>> 2a9d392160a6de350e8fdad51b5d4703b051d231
10 changes: 9 additions & 1 deletion templates/student_login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
<div class="input-field col s12">
<select name="student_id" id="students">
{% for student in students %}
{% if student_err %}
{% if student_err.id == student.id %}
<option value="{{ student.id }}" selected>{{ student.last_name }}, {{ student.first_name }}</option>
{% else %}
<option value="{{ student.id }}">{{ student.last_name }}, {{ student.first_name }}</option>
{% endif %}
{% else %}
<option value="{{ student.id }}">{{ student.last_name }}, {{ student.first_name }}</option>
{% endif %}
{% endfor %}
<label for="students">Students</label>
</select>
Expand All @@ -20,7 +28,7 @@
</div>
</div>
<div class="row">
<button class="btn waves-effect waves-light lc-light-orange right" type="submit" name="action">Sign-In</button>
<button class="btn waves-effect waves-light right" type="submit" name="action">Sign-In</button>
</div>
</form>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/teacher_login.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
</div>
<div class="row">
<button class="btn waves-effect waves-light lc-orange right" type="submit" name="action">Login</button>
<button class="btn waves-effect waves-light lc-light-orange right" type="submit" name="action">Login</button>
</div>
</form>
</div>
Expand Down Expand Up @@ -59,7 +59,7 @@
</div>
</div>
<div class="row">
<button class="btn waves-effect waves-light lc-orange right" type="submit" name="action">Signup</button>
<button class="btn waves-effect waves-light lc-light-orange right" type="submit" name="action">Signup</button>
</div>
</form>
</div>
Expand Down
3 changes: 2 additions & 1 deletion val.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ def wrong_email(x):
if not re.match(r"[^@]+@[^@]+\.[^@.]+", x):
return True
else:
return False
return False

0 comments on commit 2bc866d

Please sign in to comment.