Commit 42f355ef authored by legton's avatar legton Committed by bhmeyer

add permission

parent 812aeeeb
Pipeline #20171 passed with stage
in 2 minutes and 39 seconds
......@@ -21,7 +21,7 @@ urlpatterns = [
url(r'^degree/(?P<submission_id>\w*)/', include('degree.urls', namespace='degree')),
url(r'^adega/cepe9615/(?P<submission_id>\w*)/', include('cepe9615.urls', namespace='cepe9615')),
url(r'^cepe9615/(?P<submission_id>\w*)/', include('cepe9615.urls', namespace='cepe9615')),
url(r'^public/', include('public.urls', namespace='public')),
......
from django.db import models
from django.contrib.auth.models import User
class Cepe9615(models.Model):
name = models.CharField(max_length=40)
code = models.CharField(max_length=40)
manager = models.ForeignKey(User)
def __str__(self):
return self.name
def clean_code(self):
if '/' in self.code:
raise ValidationError('Valor inválido: O código não pode conter "/"')
# Create your models here.
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
from report_api.views import get_cepe9615_information
from cepe9615.models import Cepe9615
from report_api.views import get_degree_information
from degree.models import Degree
from submission.models import Submission
import json
from guardian.decorators import permission_required_or_403
@permission_required_or_403('view_cepe9615', (Submission, 'id', 'submission_id'))
def index(request, submission_id):
submission_id = int(submission_id)
......
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