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

179
Visualizações
On adding a Model using the Admin Panel in Django, is there a way to implement altering other Models?

I am using the standard Admin Panel in Django that has a Model, Product, that contains its information. the Product has a TextField() Summary of words.

I would like to implement a Keyword model that has a single word. The idea is that the Keyword would be applied to multiple Products if the Product has the Keyword's word in its Summary.

I am trying to implement that when the Admin in the Admin panel adds a Keyword model, the server would automatically assign each Product that Keyword.

The issue is that I do not know how to edit the Admin Panel's add function to edit other models upon adding one model. My current understanding in Django is that you could create a custom view to add a Keyword, but I would like to have the option to implement it in the Django Admin Panel as well. Products should have multiple Keywords.

Here is my models.py:

    from django.db import models

    class Product(models.Model):
        id = models.BigAutoField(primary_key=True)
        product_summary = models.TextField() # Contains a paragraph of words describing the product
    class Keyword(models.Model):
        # Used for searching Products by unique keywords to display, like tags.
        keyword = models.CharField(max_length=100)
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I think you can use the save() function and extend them in your model to do what you want. but this isn't really good for performance since you want to query other objects.
Another way would be to use django signals to signal the other objects.

over 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