Skip to content

Commit 987a11e

Browse files
authored
Update Readme (#52)
1 parent 28d4257 commit 987a11e

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Nice introduction is available here: <https://gist.github.com/Nagyman/9502133>
2929

3030
## Installation
3131

32+
First, install the package with pip.
33+
3234
``` bash
3335
$ pip install django-fsm-2
3436
```
@@ -39,6 +41,16 @@ Or, for the latest git version
3941
$ pip install -e git://github.com/django-commons/django-fsm-2.git#egg=django-fsm
4042
```
4143

44+
Register django_fsm in your list of Django applications
45+
46+
```python
47+
INSTALLED_APPS = (
48+
...,
49+
'django_fsm',
50+
...,
51+
)
52+
```
53+
4254
## Migration from django-fsm
4355

4456
django-fsm-2 is a drop-in replacement, it's actually the same project but from a different source.
@@ -397,8 +409,9 @@ practically negating their effect.
397409

398410
Renders a graphical overview of your models states transitions
399411

400-
You need `pip install "graphviz>=0.4"` library and add `django_fsm` to
401-
your `INSTALLED_APPS`:
412+
1. You need `pip install "graphviz>=0.4"` library
413+
414+
2. Make sure `django_fsm` is in your `INSTALLED_APPS` settings:
402415

403416
``` python
404417
INSTALLED_APPS = (
@@ -408,6 +421,8 @@ INSTALLED_APPS = (
408421
)
409422
```
410423

424+
3. Then you can use `graph_transitions` command:
425+
411426
``` bash
412427
# Create a dot file
413428
$ ./manage.py graph_transitions > transitions.dot

tests/testapp/tests/test_multidecorators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from django_fsm.signals import post_transition
99

1010

11-
class TestModel(models.Model):
11+
class MultiDecoratedModel(models.Model):
1212
counter = models.IntegerField(default=0)
1313
signal_counter = models.IntegerField(default=0)
1414
state = FSMField(default="SUBMITTED_BY_USER")
@@ -24,12 +24,12 @@ def count_calls(sender, instance, name, source, target, **kwargs):
2424
instance.signal_counter += 1
2525

2626

27-
post_transition.connect(count_calls, sender=TestModel)
27+
post_transition.connect(count_calls, sender=MultiDecoratedModel)
2828

2929

3030
class TestStateProxy(TestCase):
3131
def test_transition_method_called_once(self):
32-
model = TestModel()
32+
model = MultiDecoratedModel()
3333
model.review()
3434
assert model.counter == 1
3535
assert model.signal_counter == 1

tests/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
from django.core.wsgi import get_wsgi_application
1414

15-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "silvr.settings")
15+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
1616

1717
application = get_wsgi_application()

0 commit comments

Comments
 (0)