Question: Is there any simple way to define critical section?
when a user during the updating some database table, I'd force to make the other user cannot update on the same tables.

Answer: 
> 
> django-concurrency is an optimistic lock [1](https://github.com/saxix/django-concurrency) implementation for
>  Django.
> 
> 
> Tested with: 1.4.x, 1.5.x, 1.6.x, 1.7.x 1.8.x.
> 
> 
> It prevents users from doing concurrent editing in Django both from UI
>  and from a django command.
> 
> 
> 

I never used, but i think this can solve your problem.
[django-concurrency](https://github.com/saxix/django-concurrency)
It depends what are your queries, Your single query to the database will never face any race condition due to **ACID principle** impose by the database. But if there is any condition like first you are reading the data from database and after some operation on application level you are writing the updated data back to the database, then race condition may occur for that you have to implement the **locks or the mutex** in python.