From 8b1ee98a6ddd742660827a2cb19aeaddeebabf53 Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Sun, 18 Oct 2015 22:43:32 -0400 Subject: [PATCH] Fix busted tags after edit. --- snipts/api.py | 4 ++- .../templates/snipts/snipt-js-template.html | 30 +++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/snipts/api.py b/snipts/api.py index 10393e7..3d7823a 100644 --- a/snipts/api.py +++ b/snipts/api.py @@ -368,6 +368,8 @@ class PrivateSniptResource(ModelResource): 'last_user_saved', full=False) tags_list = ListField() + tags = fields.ToManyField(PublicTagResource, 'tags', related_name='tag', + full=True) class Meta: queryset = Snipt.objects.all().order_by('-created') @@ -418,7 +420,7 @@ class PrivateSniptResource(ModelResource): def obj_create(self, bundle, **kwargs): bundle.data['last_user_saved'] = bundle.request.user bundle.data['tags_list'] = bundle.data.get('tags') - bundle.data['tags'] = '' + bundle.data['tags'] = [] bundle.data['user'] = \ User.objects.get(username=bundle.data['intended_user']) diff --git a/snipts/templates/snipts/snipt-js-template.html b/snipts/templates/snipts/snipt-js-template.html index a441f60..d2434e5 100644 --- a/snipts/templates/snipts/snipt-js-template.html +++ b/snipts/templates/snipts/snipt-js-template.html @@ -35,11 +35,9 @@