load body if no edit is defined

This commit is contained in:
j 2022-08-31 10:59:08 +02:00
parent fa0c383227
commit a334dc6b4f
2 changed files with 40 additions and 31 deletions

View file

@ -353,6 +353,7 @@ function loadAnnotations(config) {
}) })
} else { } else {
var cited = {} var cited = {}
if (config.edit) {
pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => { pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => {
var annotations = [] var annotations = []
response.data.clips.forEach(clip => { response.data.clips.forEach(clip => {
@ -388,6 +389,12 @@ function loadAnnotations(config) {
renderAnnotations(config) renderAnnotations(config)
}) })
}) })
} else {
if (!config.annotations) {
config.annotations = []
}
renderAnnotations(config)
}
} }
} }

View file

@ -7,6 +7,8 @@ from ..widgets import PrettyJSONWidget
@admin.decorators.register(models.Text) @admin.decorators.register(models.Text)
class TextAdmin(admin.ModelAdmin): class TextAdmin(admin.ModelAdmin):
save_on_top = True
formfield_overrides = { formfield_overrides = {
JSONField: {'widget': PrettyJSONWidget} JSONField: {'widget': PrettyJSONWidget}
} }