Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
Disable Delete for specific records of inline form Django Admin

I have a stacked inline form in my admin.py:

class XYZInline(admin.TabularInline):

   model = XYZ
   readonly_fields = ['modify', 'approver_page']
   form = XYZForm
   extra = 0

And I have it initialized in another model on the admin.py:

class SomeOhterModelAdmin(admin.ModelAdmin):
    inlines = [XYZInline]

What I want to do is disable the Delete checkbox in the Inline form for specific form records after checking the value of some of the inputs on the records of the form. If a certain input value matches, we disable the checkbox, otherwise we don't. How can we do this? And how can we check for input values of some of the fields of the form?

Some stackoverflow examples suggest adding a self.can_delete=False to the form initializer method. However, that would disable delete for all the form records of the Inline model.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda