models.py 417 Bytes
Newer Older
1
2
from django.db import models
from django.contrib.auth.models import User
Odair M.'s avatar
Odair M. committed
3
4
5
6
7
8
9

class Degree(models.Model):
    name = models.CharField(max_length=40)

    code = models.CharField(max_length=40)

    manager = models.ForeignKey(User)
10
    def __str__(self):
11
        return self.name
Odair M.'s avatar
Odair M. committed
12
13
14
15
    def clean_code(self):
        if '/' in self.code:
            raise ValidationError('Valor inválido: O código não pode conter "/"')