List_Display in Django / Python

0

sXDw.png

My class Models are like that

class Produto(models.Model):
    NomeRazao =    models.CharField('Nome',max_length=50,unique=False,blank=False)
    CpfCnpj = models.IntegerField('Quantidade',blank=False)
    Telefone = models.FloatField('Preço de Compra',blank=False)
    Total = models.IntegerField('Preço de Venda',blank=False)'

and Admin like this

class ProdutoAdmin(admin.ModelAdmin):
    list_display=('NomeRazao','CpfCnpj','InscEstadual','Total')
    search_fields = ('NomeRazao',)
    ordering = ('NomeRazao',)
    exclude =('Usuario',)
    
asked by anonymous 25.06.2018 / 23:26

1 answer

0

I think you're wanting specific fields in the form, if that's what you have to use fields and not list_display

Only name and title will be displayed in form

models.py

class Author(models.Model):
        name = models.CharField(max_length=100)
        title = models.CharField(max_length=3)
        birth_date = models.DateField(blank=True, null=True)

admin.py

class AuthorAdmin(admin.ModelAdmin):
    fields = ('name', 'title')
    
26.06.2018 / 02:52