mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-06 22:05:09 +01:00
json view of public tag page
This commit is contained in:
@@ -4,12 +4,17 @@
|
||||
- Sort by title
|
||||
- Sort by date
|
||||
- Logging of actions
|
||||
- json/rss views of public tag pages
|
||||
- rss views of public tag pages
|
||||
- On tags overview page:
|
||||
- Show which tags have public pages, with link
|
||||
- How many bookmarks each tag has
|
||||
|
||||
|
||||
## v0.3.0 (unreleased)
|
||||
|
||||
- rss view of public tag pages
|
||||
|
||||
|
||||
## v0.2.0
|
||||
|
||||
2016-08-02
|
||||
|
||||
17
digimarks.py
17
digimarks.py
@@ -11,7 +11,7 @@ from urlparse import urlparse, urlunparse
|
||||
|
||||
from utilkit import datetimeutil
|
||||
|
||||
from flask import Flask, abort, redirect, render_template, request, url_for
|
||||
from flask import Flask, abort, redirect, render_template, request, url_for, jsonify
|
||||
from flask_peewee.db import Database
|
||||
#from flask_peewee.utils import get_object_or_404
|
||||
from peewee import * # noqa
|
||||
@@ -403,6 +403,21 @@ def publictag(tagkey):
|
||||
abort(404)
|
||||
|
||||
|
||||
@app.route('/pub/<tagkey>/json')
|
||||
def publictagjson(tagkey):
|
||||
""" json representation of the Read-only overview of the bookmarks in the userkey/tag of this PublicTag """
|
||||
#this_tag = get_object_or_404(PublicTag.select().where(PublicTag.tagkey == tagkey))
|
||||
try:
|
||||
this_tag = PublicTag.get(PublicTag.tagkey == tagkey)
|
||||
bookmarks = Bookmark.select().where(Bookmark.userkey == this_tag.userkey, Bookmark.tags.contains(this_tag.tag), Bookmark.status == Bookmark.VISIBLE)
|
||||
result = {'count': len(bookmarks), 'items': []}
|
||||
for bookmark in bookmarks:
|
||||
result['items'].append(bookmark.to_dict())
|
||||
return jsonify(result)
|
||||
except PublicTag.DoesNotExist:
|
||||
abort(404)
|
||||
|
||||
|
||||
@app.route('/<userkey>/<tag>/makepublic', methods=['GET', 'POST'])
|
||||
def addpublictag(userkey, tag):
|
||||
#user = get_object_or_404(User.get(User.key == userkey))
|
||||
|
||||
Reference in New Issue
Block a user