Last active
April 20, 2020 15:46
-
-
Save paltman/7225dbf00202e332bf8f98c4887bf747 to your computer and use it in GitHub Desktop.
Revisions
-
paltman revised this gist
Apr 20, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ <template> <div class="bookmark-list"> <button @click="refresh">Refresh</button> <div v-for="(bookmark, index) in bookmarks" :key="index"> <a :href="bookmark.url">{{ bookmark.title }}</a> </div> -
paltman revised this gist
Apr 20, 2020 . 1 changed file with 8 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,10 +15,15 @@ export { bookmarks: [], } }, methods: { refresh() { api.getBookmarks(data => { this.bookmarks = data.bookmarks; }); } }, created() { this.refresh(); } } </script> -
paltman created this gist
Apr 20, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ <template> <div class="bookmark-list"> <div v-for="(bookmark, index) in bookmarks" :key="index"> <a :href="bookmark.url">{{ bookmark.title }}</a> </div> </div> </template> <script> import api from './api'; export { data() { return { bookmarks: [], } }, created() { api.getBookmarks(data => { this.bookmarks = data.bookmarks; }); } } </script> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ def bookmarks(request): data = [b.data() for b in Bookmark.objects.all()] return JSONResponse(data=dict(bookmarks=data)) This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ class Bookmark(models.Model): title = models.CharField(max_length=250) url = models.CharField(max_length=500) def data(self): return dict(title=self.title, url=self.url)