Show log_entries on private snipts in API.

master
Nick Sergeant 2015-09-24 16:55:59 -04:00
parent 6182b43868
commit f7a3901507
1 changed files with 13 additions and 0 deletions

View File

@ -392,6 +392,19 @@ class PrivateSniptResource(ModelResource):
bundle.data['publish_date'] = \
date(bundle.data['publish_date'], 'M d, Y \\a\\t h:i A')
log_entries = bundle.obj.sniptlogentry_set.all()
bundle_log_entries = []
for entry in log_entries:
bundle_log_entries.append({
'created': entry.created,
'user': entry.user,
'code': entry.code,
'diff': entry.diff
})
bundle.data['log_entries'] = bundle_log_entries
return bundle
def obj_create(self, bundle, **kwargs):