Last active
December 1, 2022 20:51
-
-
Save guionardo/b9223871bd08d1bb27b3e4e1e19a4630 to your computer and use it in GitHub Desktop.
Bug OS/Contato
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@admin.register(OS) | |
class AdminOS(DjangoObjectActions, AdminBaseModel): | |
list_display = ['__str__', 'situacao', # 'cliente', | |
'produto', 'nr_projeto', 'tempo', 'descricao', 'updated'] | |
search_fields = ['nr_os', 'nr_projeto', 'descricao'] | |
list_filter = ['situacao', 'produto__cliente__nome'] | |
readonly_fields_on_update = ['created_by', 'updated'] # , 'cliente' | |
fields = (('data_abertura', 'solicitante'), # , 'cliente' | |
('produto', 'nr_projeto'), | |
'situacao', | |
'descricao', | |
'link_manual', | |
'data_fechamento', | |
('created_by') # 'created', | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contato(BaseModel): | |
nome = models.CharField(max_length=100) | |
telefone = models.CharField(max_length=20) | |
email = models.CharField(max_length=100, validators=[EmailValidator()]) | |
enabled = models.BooleanField(default=True, verbose_name='Ativo') | |
cliente = models.ForeignKey( | |
Cliente, on_delete=models.PROTECT, null=False) | |
setor = models.CharField(max_length=40, default="") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OS(BaseModel): | |
nr_os = models.CharField(max_length=5, unique=True, editable=False) | |
produto = models.ForeignKey(Produto, on_delete=models.PROTECT) | |
nr_projeto = models.CharField( | |
max_length=32, null=False, unique=True, verbose_name='# Projeto') | |
situacao = models.CharField( | |
max_length=2, choices=OSSituacaoChoices.choices, default=OSSituacaoChoices.ABERTA) | |
solicitante = models.ForeignKey(Contato, on_delete=models.PROTECT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment