Skip to content

Commit 5625d9e

Browse files
committed
update readme with more stuffffffsssss
1 parent 4b61d5d commit 5625d9e

File tree

1 file changed

+50
-22
lines changed

1 file changed

+50
-22
lines changed

Diff for: README.md

+50-22
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,82 @@ Django Object Actions
33

44
If you've ever tried making your own admin object tools and you were like me,
55
you immediately gave up. Why can't they be as easy as making Django Admin
6-
Actions? Well now they can!
6+
Actions? Well now they can be.
77

8-
This is very similar to [django-object-tools], but does not require messing with
9-
your urls.py, does not do anything special with permissions, and uses a subset
10-
of the language you already know from making [django admin actions].
8+
### Similar Packages
9+
10+
Django Object Actions is very similar to [django-object-tools], but does not
11+
require messing with your urls.py, does not do anything special with
12+
permissions, and uses the same patterns as making [admin actions] in Django.
1113

1214
[django-object-tools]: https://github.com/praekelt/django-object-tools
13-
[django admin actions]: https://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actions-as-modeladmin-methods
15+
[admin actions]: https://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actions-as-modeladmin-methods
16+
1417

18+
## Installation
1519

16-
Installation
17-
------------
20+
Install Django Object Actions. Currently, this has to be done manually.
1821

1922
Add `django_object_actions` to your `INSTALLED_APPS`.
2023

21-
Or just put the template some place Django can find it.
24+
### Alternate Installation
25+
26+
Install Django Object Actions. Currently, this has to be done manually.
27+
28+
Copy the templates some place Django's template loader [will find it].
29+
30+
[will find it]: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
2231

23-
Example Usage
24-
-------------
32+
## Usage
2533

26-
Tools are defined just like defining actions as modeladmin methods, see: [django
27-
admin actions] for examples and detailed syntax. The major difference being
28-
the functions you write will take an object instead of a queryset:
34+
Tools are defined just like defining actions as modeladmin methods, see: [admin
35+
actions] for examples and detailed syntax. You can return nothing or an http
36+
response. The major difference being the functions you write will take an object
37+
instance instead of a queryset:
2938

3039
def toolfunc(self, request, obj)
3140

32-
They are exposed by putting them in a `objectactions` attribute in your
41+
Tools are exposed by putting them in an `objectactions` attribute in your
3342
modeladmin like:
3443

3544
class MyModelAdmin(DjangoObjectActions, admin.ModelAdmin):
3645
def toolfunc(self, request, obj):
3746
pass
38-
toolfunc.short_description = "This will be the tooltip of the button"
47+
toolfunc.label = "This will be the label of the button" # optional
48+
toolfunc.short_description = "This will be the tooltip of the button" # optional
3949

40-
objectactions = ('toolfunc',)
50+
objectactions = ('toolfunc', )
4151

4252
Just like actions, you can send a message with `self.message_user`. Normally,
4353
you would do something to the object and go back to the same place, but if you
4454
return a HttpResponse, it will follow it (hey, just like actions!).
4555

46-
Limitations: django-object-actions expects these functions to be methods of the
47-
model admin.
56+
### Limitations
57+
django-object-actions expects these functions to be methods of the model admin.
4858

49-
Development
50-
-----------
59+
If you provide your own custom change_form.html, you'll also need to manually
60+
copy in the relevant bits of [our change form].
5161

52-
Getting started:
62+
[our change form]: https://github.com/texastribune/django-object-actions/blob/master/django_object_actions/templates/django_object_actions/change_form.html
5363

64+
## Development
65+
66+
Getting started _(with virtualenvwrapper)_:
67+
68+
# get a copy of the code
69+
git clone git@github.com:texastribune/django-object-actions.git
70+
cd django-object-actions
71+
# set up your virtualenv
72+
mkvirtualenv django-object-actions
5473
pip install -r requirements-dev.txt
74+
export DJANGO_SETTINGS_MODULE=example_project.settings
75+
add2virtualenv .
76+
# start doing stuff
77+
make test
78+
make resetdb
79+
python example_project/manage.py runserver
80+
81+
The fixtures will create a user, admin:admin, you can use to log in immediately.
82+
5583

56-
Various helpers available as make commands.
84+
Various helpers are available as make commands.

0 commit comments

Comments
 (0)