Commit a153b366 authored by Odair M.'s avatar Odair M.
Browse files

adiciona funçoes da dashboard e inicia classe da views degree

parent 9d6f7fd6
from django.db import models
from django.contrib.auth.models import User
from django.db import modelsfrom django.contrib.auth.models import User
class Degree(models.Model):
name = models.CharField(max_length=40)
......@@ -8,7 +8,7 @@ class Degree(models.Model):
manager = models.ForeignKey(User)
def __str__(self):
return self.code
return self.name
def clean_code(self):
if '/' in self.code:
raise ValidationError('Valor inválido: O código não pode conter "/"')
......
{% extends 'adega/base.html' %}
<h1>{{degree}}<\h1>
from django.conf.urls import url
from . import views
urlpatterns = patterns('',url(r'^$', views.index, name='index'))
from django.shortcuts import render
from django.shortcuts import render, redirect
from django.views.generic import view
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout as process_logout
# 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:
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