Commit c0ef8ce7 authored by Odair M.'s avatar Odair M. Committed by Odair M.
Browse files

construção da pagina curso iniciada, arruma diretório dos jsons

parent 182014e4
......@@ -44,7 +44,7 @@ INSTALLED_APPS = [
'adega',
'public',
'degree',
'educator',
'educator',
'uploads'
]
......
......@@ -4,5 +4,8 @@
{% block content%}
<h2>Dashboard</h2>
{% for degree in degrees %}
<a href="{% url 'degree:index' degree_id=degree.code %}">{{degree}} </a>
{% endfor %}
{% endblock content %}
\ No newline at end of file
{% endblock content %}
......@@ -4,10 +4,28 @@
</div>
<div class="collapse navbar-collapse" id="navbartoggle">
<span class="navbar-brand mr-auto">
Ciência da Computação
{% if degree != None %}
<a href="{% url 'degree:index' degree_id=degree.code%}">{{degree.name}} </a>
{% endif %}
</span>
{% comment %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Cursos <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
{% if len(user.educator.degree.all()) > 1 %}
{% for degree in user.educator.degree.all() %}
<li><a href="{% url 'degree:index'
degree_id=degree.code%}">{{degree.name}} </a></li>
{% endfor %}
{% else %}
{% endif %}
</ul>
</li>
{% endcomment %}
<span class="navbar-text">
Relatório 2016/1
</span>
......
from django.conf.urls import include, url
from django.contrib import admin
......@@ -8,6 +9,8 @@ urlpatterns = [
url(r'^uploads/', include('uploads.urls', namespace='uploads')),
url(r'^degree/(?P<degree_id>\w*)/', include('degree.urls', namespace='degree')),
url(r'^public/', include('public.urls', namespace='public')),
url(r'^logout/$', views.logout, name='logout'),
......
......@@ -8,8 +8,10 @@ from django.contrib.auth import logout as process_logout
@login_required
def dashboard(request):
return render(request, 'adega/dashboard.html', {'title': 'Dashboard'})
degree = request.user.educator.degree.all()
return render(request, 'adega/dashboard.html', {'title': 'Dashboard',
"degrees":degree
})
@login_required
......
from django.db import modelsfrom django.contrib.auth.models import User
from django.db import models
from django.contrib.auth.models import User
class Degree(models.Model):
name = models.CharField(max_length=40)
......
{% extends 'adega/base.html' %}
<h1>{{degree}}<\h1>
{% extends 'base.html' %}
{% block content%}
<h1>{{degree.name}}</h1>
{% endblock content %}
from django.conf.urls import url
from . import views
urlpatterns = patterns('',url(r'^$', views.index, name='index'))
from degree import views
urlpatterns = [url(r'^$',views.index, name='index')
]
from django.shortcuts import render, redirect
from django.views.generic import view
from django.views.generic import View
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout as process_logout
from degree.models import *
# Create your views here.
@login_required
def setDegree(request,degree_id):
request.session["degree"] = degree_id
return redirect('public:index' )
@login_required
def Degreeindex(request):
if(!("degree" in request.session)):
return redirect('dashboard')
class Views(view):
template_name = "index.html"
@login_required
def setDegree(self,request,degree_id):
request.session["degree" ] = degree_id
return redirect('degree:index' )
def index(self,request):
degree = Degree.objects.get(code = request.session["degree"])
submission = degree.submission
if (("submission" in request.session)):
submission = request.session["submission"]
submission = Submission.objects.get(id = submission)
degree_path = submission.path()
with open(submission.path()) as File:
def index(request,degree_id):
degree = Degree.objects.get(code=degree_id)
return render(request,"degree/index.html",{"degree":degree})
#class Views(View):
# template_name = "index.html"
# @login_required
# def setDegree(self,request,degree_id):
# request.session["degree"] = degree_id
# return redirect('degree:index' )
# def index(self,request):
# if("degree" in request.session):
# degree = Degree.objects.get(code = request.session["degree"])
# else:
# return redirect("adega:dashboard")
# submission = degree.submission
# return render(request,"degree/index",{"degree":degree})
#
#
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