Skip to content

Commit

Permalink
Merge pull request #3 from praekelt/feature/Add-search-to-admin
Browse files Browse the repository at this point in the history
Add search to admin
  • Loading branch information
cblignaut committed Feb 15, 2017
2 parents 5154bca + 2593378 commit f79100b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ dist/
coverage.xml
pep8.txt
.tox/
.coverage
.coverage
5 changes: 4 additions & 1 deletion navbuilder/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ class MenuAdmin(admin.ModelAdmin):
list_display = ["title"]
inlines = [MenuItemInline]
prepopulated_fields = {"slug": ["title"]}
search_fields = ["title", "slug"]


class MenuItemAdmin(admin.ModelAdmin):
form = MenuItemAdminForm
list_display = ["title", "_get_absolute_url"]
list_display = ["title", "parent", "_get_absolute_url"]
prepopulated_fields = {"slug": ["title"]}
search_fields = ["title", "slug"]
list_filter = ["menu"]

def _get_absolute_url(self, obj):
try:
Expand Down

0 comments on commit f79100b

Please sign in to comment.