Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!