Skip to content

Commit

Permalink
updated Advanced Usage in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Arulnathan committed Jan 31, 2014
1 parent 82b1670 commit 3017997
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,17 @@ article.submit(by=some_user) # StateLog.by will be some_user

### Advanced Usage
You can change the behaviour of this app by turning on caching for StateLog records.
Simply add `DJANGO_FSM_LOG_CACHE_BACKEND = 'backend_name'` to your project's settings file. This
will store any pending StateLog records in the cache using the cache backend you specified.
Simply add `DJANGO_FSM_LOG_CACHE_BACKEND = 'django_fsm_log.backends.CachedBackend'` to your project's settings file.

The StateLog object is now available after the `django_fsm.signals.pre_transition`
signal is fired, but is deleted from the cache and persisted to the database after `django_fsm.signals.post_transition`
is fired.

This is useful if:
- you need immediate access to StateLog details, and cannot wait until `django_fsm.signals.post_transition`
has been fired
- at any stage, you need to verify whether or not the StateLog has been written to the database

This is useful if you need to verify whether or not the StateLog has been written to the database.
Access to the pending StateLog record is available via the `pending_objects` manager

```python
Expand All @@ -89,9 +96,6 @@ article = Article.objects.get(...)
pending_state_log = StateLog.pending_objects.get_for_object(article)
```

This pending StateLog object is available after the `django_fsm.signals.pre_transition`
signal is fired, but is deleted from the cache after `django_fsm.signals.post_transition`
is fired.

## Running Tests

Expand Down

0 comments on commit 3017997

Please sign in to comment.