mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-07 00:15:10 +01:00
Fix for adding bookmark
This commit is contained in:
@@ -5,7 +5,7 @@ import requests
|
|||||||
|
|
||||||
from utilkit import datetimeutil
|
from utilkit import datetimeutil
|
||||||
|
|
||||||
from flask import Flask, abort, redirect, render_template, request
|
from flask import Flask, abort, redirect, render_template, request, url_for
|
||||||
from flask_peewee.db import Database
|
from flask_peewee.db import Database
|
||||||
from flask_peewee.utils import object_list
|
from flask_peewee.utils import object_list
|
||||||
from peewee import *
|
from peewee import *
|
||||||
@@ -169,13 +169,9 @@ def addingbookmark(userkey):
|
|||||||
# abort(404)
|
# abort(404)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
print request
|
|
||||||
print request.form
|
|
||||||
title = request.form['title']
|
title = request.form['title']
|
||||||
print title
|
|
||||||
url = request.form['url']
|
url = request.form['url']
|
||||||
tags = request.form['tags']
|
tags = request.form['tags']
|
||||||
print url
|
|
||||||
if url:
|
if url:
|
||||||
bookmark = Bookmark(url=url, title=title, tags=tags, userkey=userkey)
|
bookmark = Bookmark(url=url, title=title, tags=tags, userkey=userkey)
|
||||||
bookmark.sethash()
|
bookmark.sethash()
|
||||||
@@ -184,7 +180,8 @@ def addingbookmark(userkey):
|
|||||||
# Title was empty, automatically fetch it from the url
|
# Title was empty, automatically fetch it from the url
|
||||||
bookmark.get_title_from_source()
|
bookmark.get_title_from_source()
|
||||||
bookmark.save()
|
bookmark.save()
|
||||||
return redirect(url)
|
#return redirect(url)
|
||||||
|
return redirect(url_for('editbookmark', userkey=userkey, urlhash=bookmark.url_hash))
|
||||||
abort(404)
|
abort(404)
|
||||||
return redirect(url_for('add'))
|
return redirect(url_for('add'))
|
||||||
|
|
||||||
|
|||||||
@@ -8,36 +8,30 @@
|
|||||||
|
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<i class="material-icons prefix">description</i>
|
<i class="material-icons prefix">description</i>
|
||||||
<input placeholder="title" type="text" id="title" value="{{ title }}" class="validate" />
|
<input placeholder="title" type="text" name="title" id="title" value="{{ bookmark.title }}" class="validate" />
|
||||||
<label for="title">Title</label>
|
<label for="title">Title</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<i class="material-icons prefix">turned_in</i>
|
<i class="material-icons prefix">turned_in</i>
|
||||||
<input placeholder="url" type="text" id="url" value="{{ url }}" class="validate" />
|
<input placeholder="url" type="text" name="url" id="url" value="{{ bookmark.url }}" class="validate" />
|
||||||
<label for="url">URL</label>
|
<label for="url">URL</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<i class="material-icons prefix">label</i>
|
<i class="material-icons prefix">label</i>
|
||||||
<input placeholder="tags, supported by comma's" type="text" id="tags" value="{{ tags }}" class="validate" />
|
<input placeholder="tags, supported by comma's" type="text" name="tags" id="tags" value="{{ bookmark.tags }}" class="validate" />
|
||||||
<label for="tags">Tags</label>
|
<label for="tags">Tags</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
{#<i class="material-icons prefix">star</i>#}
|
{#<i class="material-icons prefix">star</i>#}
|
||||||
<div class="switch">
|
<input type="checkbox" name="starred" id="starred" />
|
||||||
<label>
|
<label for="starred">Starred</label>
|
||||||
Normal
|
|
||||||
<input type="checkbox" id="starred">
|
|
||||||
<span class="lever"></span>
|
|
||||||
Starred
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-field col m12">
|
<div class="input-field col m12">
|
||||||
<p class="left-align"><button class="btn btn-large waves-effect waves-light" type="submit" name="action">Save</button></p>
|
<p class="left-align"><button class="btn btn-large waves-effect waves-light" type="submit" name="submit">Save</button></p>
|
||||||
</div>
|
</div>
|
||||||
{# <input type="submit" value="Save" /> #}
|
{# <input type="submit" value="Save" /> #}
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user