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

191
Vistas
How can I select records n-at-a-time for multiple users to edit?

I am using a Django backend with postgresql.

Let's say I have a database with a table called Employees with about 20,000 records.

I need to allow multiple users to edit and verify the Area Code field for every record in Employees.

I'd prefer to allow a user to view the records, say, 30 at a time (to reduce burnout).

How can I select 30 records at a time from Employees to send to the front end UI for editing, without letting multiple users edit the same records, or re-selecting a record that has already been verified?

I don't need comments on the content of the database (these are example table and field names).

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

0

One way to do this would be to add 2 more fields to your table, say for example assigned_to and verified. You can update assigned_to, which can be a foreign key to the verifying user, when you allow the user to view that Employee. This will create a record preventing the Employee from being chosen twice. assigned_to can also double as a record of who verified this Employee for future reference.

verified could be simply a Boolean field which keeps track if the Employee has already been verified and can be updated when the user confirms the verification

The actual selects can be done like this:

employees = Employee.objects.filter(assigned_to=None, verified=False)[:30]

Then

for emp in employees:
        emp.assigned_to = user
        emp.save()

Note: This can still potentially cause a race condition if 2 users make this request at exactly the same time. To avoid this, another possibility could be to partition the employee tables into groups for each user with no overlap. This would ensure that no 2 users would ever have the same employees

over 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