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

app educator, modelagem do db para usuarios

parent 8d0ce1df
......@@ -3,6 +3,3 @@ from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
class Professor(models.Model):
user = models.OneToOneField(User)
......@@ -44,6 +44,7 @@ INSTALLED_APPS = [
'adega',
'public',
'degree',
'educator',
'uploads'
]
......
......@@ -7,7 +7,8 @@ class Degree(models.Model):
code = models.CharField(max_length=40)
manager = models.ForeignKey(User)
def __str__(self):
return self.code
def clean_code(self):
if '/' in self.code:
raise ValidationError('Valor inválido: O código não pode conter "/"')
......
from django.contrib import admin
from .models import Educator
# Register your models here.
admin.site.register(Educator)
from django.db import models
from django.contrib.auth.models import User
from degree.models import Degree
# Create your models here.
class Educator(models.Model):
user = models.OneToOneField(User)
degree = models.ManyToManyField(Degree)
def __str__(self):
return "{}".format(self.user.username)
......@@ -6,7 +6,6 @@ from django.contrib import messages
from uploads.models import Submission
@login_required
def upload(request):
if request.method == 'POST' and request.FILES['historico'] and request.FILES['matricula']:
......
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