Commit 59d8eeb5 authored by Gab De Jesus's avatar Gab De Jesus

Added login required decorators, html design, and showing of specific prof

parent c1363a8a
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
.static_storage/
.media/
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
\ No newline at end of file
from django.shortcuts import render, redirect
from django.urls import reverse
from profs.models import Prof
from profs.forms import ProfForm
# Create your views here.
def index(request):
if(request.method=='POST'):
form = ProfForm(request.POST)
if(form.is_valid()):
form.save()
# Return to profs_index using reverse so only need to change url in settings.py
return redirect(reverse('profs_index'))
profs = Prof.objects.all()
return render(request, 'profs/index.html', {'prof_form':ProfForm, 'profs': profs})
{% extends 'templates/base.html' %}
{% block content %}
<div>
<h1><center>{{prof.first_name}} {{prof.last_name}}</center></h1>
<h3><center>Reviews</center></h3>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>Rating</th>
<th>Review</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
{% for review in reviews %}
<tr>
<th scope="row">{{ review.id }}</th>
<td>{{ review.rating }}</td>
<td>{{ review.message }}</td>
<td>{{ review.created_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="form-group">
<label for="comment">Review {{ prof.first_name }} {{ prof.last_name }}</label>
<textarea class="form-control" rows="5" id="comment"></textarea>
<button type="submit" class="btn btn-default">Submit Review</button>
</div>
{% endblock %}
\ No newline at end of file
${content}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>
<body>
<!-- NAVBAR WITH FORM -->
<nav class="navbar navbar-light navbar-toggleable-md bg-faded">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNav"><span class="navbar-toggler-icon"></span></button>
<a class="navbar-brand" href="#">Welcome to Academe!</a>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link btn" href="Academe_home.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Services</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
<form class="form-inline">
<input type="text" class="form-control" placeholder="Search">
<button class="btn btn-outline-success">Search</button>
</form>
</div>
</div>
</nav>
<br>
<div>
<p>
Danao, Adrian Dominic
<div>
<p>Classes</p>
<a class="btn" href="#">Introduction to Kapogian I</a>
<a class="btn" href="#">Introduction to Kapogian II</a>
<a class="btn" href="#">Financial Marketing Science III</a>
</div>
</p>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>Pros</th>
<th>Cons</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>I Love him he is the best prof evur.</td>
<td>WALA</td>
<td>TAKE HIM</td>
</tr>
<tr>
<th scope="row">2</th>
<td>GIVE ME YOUR BABIES</td>
<td>None</td>
<td></td>
</tr>
<tr>
<th scope="row">3</th>
<td>I wish I was as cool as this guy</td>
<td>I think he's kinda gay</td>
<td></td>
</tr>
<tr>
<th scope="row">3</th>
<td>None</td>
<td>He sucks</td>
<td>bad</td>
</tr>
</tbody>
</table>
<div class="form-group">
<label for="comment">Comment on this prof:</label>
<textarea class="form-control" rows="5" id="comment"></textarea>
<button type="submit" class="btn btn-default">Submit Review</button>
</div>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment