Skip to content

Commit

Permalink
Add a luxurious backend admin page for the SemanticQuery model (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Jul 30, 2021
1 parent 3756a53 commit bbf1977
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion backend/items/admin.py
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)

0 comments on commit bbf1977

Please sign in to comment.