List_display in Django/Python

Asked

Viewed 302 times

0

Quero Remover o Item preço de venda dessa área...

Mas sem que ele seja removido dessa outrasXDw.png

Quero remover o item preço de venda

My Models class is like this

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 thus

class ProdutoAdmin(admin.ModelAdmin):
    list_display=('NomeRazao','CpfCnpj','InscEstadual','Total')
    search_fields = ('NomeRazao',)
    ordering = ('NomeRazao',)
    exclude =('Usuario',)
  • I just want to remove Item Sale price from the registration list without deleting it from the list of registrants

  • I tried to help editing your msg, but your links to the images are broken, okay confused, try to fix.

  • You want to customize the administration interface window to not display certain fields?

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

Here only name and title will be displayed in the form

py.models

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')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.