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

202
Visualizações
Debug from Django admin

I'm trying to have a print statement appear on the console every time I add data into my Postgres Database (For example "Post succeeded") from the Django admin but no matter where I put print statements (in admin.py or the models) nothing is appearing. I know the data is going through as there is a POST statement that goes through example of post going through
and the data is in the database.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In your Admin object, you can put a print statement in the save_model() method. It sounds like that's where it will best suit you if you want to print something after adding data.

It would look something like this:

class FooAdmin(admin.ModelAdmin):
    ...

    class Meta:
        model = Foo

    def save_model(self, request, obj, form, change):
        print('Post succeeded')
        obj.save()

admin.site.register(Foo, FooAdmin)
about 4 years ago · Santiago Trujillo Relatório
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