Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
How to implement an edit approval queue in Django

I am attempting to make it so a user can edit displayed info stored in an object but that edit is not displayed publicly until an admin approves the edit. These edits are stored in a queue that an admin can sort through. For example:

class examplemodel(models.Model):
    text = models.CharField()

This charfield is displayed on a template somewhere where a user can click a link, letting the text become a form containing the same info which when the form is submitted, sends the info not back into the database but to a queue to be approved on the admin page. The only way I can think to do this right now is to make a editRequest object that lets me have the form create a different object and then have some approval function that updates the old object if approved. In which case, how would I tie this to the admin page?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I would suggest to create a new model ApprovalPendingUsers with required fields and also add ForeignKey for user in that model. You can also add created_time and last_modified_time fields for sorting. When user submit edit form details store everything in your new model with user ForeignKey.

#import User Model
from apps.users.models import BaseUserModel 

class ApprovalPendingUsersModel (Models.Model):
    created_by = models.ForeignKey(BaseUserModel)
    # Other fields.

Create a list view for admin and return all rows of your new model to view.

class ApprovalPendingUsersListView(ListView):
    # template_name and context_object_name 

    def get_queryset(self):
        return ApprovalPendingUsersModel.objects.all()

When admin click on approval button replace BaseUserModel details with ApprovalPendingUsersModel and delete that row from ApprovalPendingUsersModel.

Use get_or_create to avoid creation of many ApprovalPendingUsersModel rows when user give more than one update requests.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda