Skip to content

Commit

Permalink
Updated documentation about staticfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
jschrewe committed Dec 9, 2011
1 parent 0a96f33 commit 476dddb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
.project
.pydevproject
38 changes: 18 additions & 20 deletions README.markdown
Expand Up @@ -16,8 +16,12 @@ run `manage.py syncdb` because _django-genericadmin_ does not have any models.
...
)

Link or copy `genericadmin/media/js/` to your asset directory and set
`GENERICADMIN_JS` to your path.
If you are using the staticfiles app, then run `manage.py collectstatic` and you should be
good to go.

If you don't know what I'm talking about or your django version < 1.3, then you
should link or copy `genericadmin/media/js/` to your asset directory and set
`GENERICADMIN_JS` to a the relative destination of your just copied files.

## Usage

Expand Down Expand Up @@ -48,29 +52,25 @@ That's it.
To use _django-genericadmin_ with admin inlines, your models must inherit from
`GenericAdminModelAdmin` as described above:

<pre>
from genericadmin.admin import GenericAdminModelAdmin
from genericadmin.admin import GenericAdminModelAdmin

class NavBarEntryAdmin(GenericAdminModelAdmin):
pass
class NavBarEntryAdmin(GenericAdminModelAdmin):
pass

admin.site.register(NavBarEntry, NavBarEntryAdmin)
</pre>
admin.site.register(NavBarEntry, NavBarEntryAdmin)

Additionally the inline classes must inherit from either `GenericStackedInline`
or `GenericTabularInline`:

<pre>
from genericadmin.admin import GenericAdminModelAdmin, GenericTabularInline
from genericadmin.admin import GenericAdminModelAdmin, GenericTabularInline

class PagesInline(GenericTabularInline):
model = ...
class PagesInline(GenericTabularInline):
model = ...

class NavBarEntryAdmin(GenericAdminModelAdmin):
inlines = [PagesInline, ]
class NavBarEntryAdmin(GenericAdminModelAdmin):
inlines = [PagesInline, ]

...
</pre>
...

Note that you can't mix and match. If you're going to use a generic inline,
the class using it must inherit from `GenericAdminModelAdmin`.
Expand All @@ -80,10 +80,8 @@ the class using it must inherit from `GenericAdminModelAdmin`.
Specific content types can be removed from the content type select list.
Example:

<pre>
class NavBarEntryAdmin(GenericAdminModelAdmin):
content_type_blacklist = ('auth/group', 'auth/user', )
</pre>
class NavBarEntryAdmin(GenericAdminModelAdmin):
content_type_blacklist = ('auth/group', 'auth/user', )

Note that this only happens on the client; there is no enforcement of the
blacklist at the model level.
Expand Down
7 changes: 3 additions & 4 deletions genericadmin/admin.py
Expand Up @@ -17,10 +17,9 @@ class Media:
def __init__(self, model, admin_site):
self.grappelli = False
media = list(self.Media.js)
for app in settings.INSTALLED_APPS:
if app == 'grappelli':
media.append(JS_PATH + 'genericadmin-grappelli.js')
self.grappelli = True
if 'grappelli' in settings.INSTALLED_APPS:
media.append(JS_PATH + 'genericadmin-grappelli.js')
self.grappelli = True
if not self.grappelli:
media.append(JS_PATH + 'genericadmin.js')
self.Media.js = tuple(media)
Expand Down

0 comments on commit 476dddb

Please sign in to comment.