-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a luxurious backend admin page for the SemanticQuery model (#486)
- Loading branch information
1 parent
3756a53
commit bbf1977
Showing
1 changed file
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from .models import SemanticQuery | ||
|
||
|
||
@admin.register(SemanticQuery) | ||
class SemanticQueryAdmin(admin.ModelAdmin): | ||
date_hierarchy = 'created' | ||
fields = ('label', 'creator', 'created', 'query') | ||
readonly_fields = ('created', 'query') | ||
autocomplete_fields = ('creator',) | ||
search_fields = ('label',) | ||
list_display = ('id', 'label', 'creator', 'created') | ||
list_display_links = ('id', 'label') | ||
list_filter = ('created', 'creator') | ||
show_full_result_count = False | ||
|
||
def view_on_site(self, obj): | ||
return '/explore/query/{}'.format(obj.id) |