From acc21182aee19325e0fc81f27521f5b5207315cd Mon Sep 17 00:00:00 2001 From: Alejandro Dubrovsky Date: Fri, 9 Sep 2016 17:18:06 +1000 Subject: [PATCH 1/3] More basic instructions on how to initialise and where to import the used models from --- README.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.rst b/README.rst index 449880b..af067b5 100644 --- a/README.rst +++ b/README.rst @@ -2,9 +2,19 @@ Django-locking ============== Usage ----- + +Add 'locking' to your INSTALLED_APPS settings, and run migrate to initialise +create the basic table + +:: + python manage.py migrate +:: + + The simplest use is by using it as a context manager: :: + from locking.models import NonBlockingLock, AlreadyLocked with NonBlockingLock.objects.acquire_lock(obj=model_obj): model_obj.do_something() From bc926df1a339437578b25c830905c9d6801df5e6 Mon Sep 17 00:00:00 2001 From: Alejandro Dubrovsky Date: Fri, 9 Sep 2016 17:20:27 +1000 Subject: [PATCH 2/3] Get the formatting right --- README.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/README.rst b/README.rst index af067b5..82fa629 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,6 @@ create the basic table :: python manage.py migrate -:: The simplest use is by using it as a context manager: From f1175c8e164793290ef64bfc0363d53922790226 Mon Sep 17 00:00:00 2001 From: Alejandro Dubrovsky Date: Fri, 9 Sep 2016 17:23:19 +1000 Subject: [PATCH 3/3] Read the instructions, get the syntax right --- README.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 82fa629..77a5222 100644 --- a/README.rst +++ b/README.rst @@ -4,23 +4,21 @@ Usage ----- Add 'locking' to your INSTALLED_APPS settings, and run migrate to initialise -create the basic table +create the basic table:: -:: python manage.py migrate -The simplest use is by using it as a context manager: +The simplest use is by using it as a context manager :: + from locking.models import NonBlockingLock, AlreadyLocked with NonBlockingLock.objects.acquire_lock(obj=model_obj): model_obj.do_something() -Or you can keep track of the lock yourself: - -:: +Or you can keep track of the lock yourself:: try: lock = NonBlockingLock.objects.acquire_lock(obj=model_obj)