mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-06 22:05:09 +01:00
Fix for adding bookmark
This commit is contained in:
@@ -5,7 +5,7 @@ import requests
|
||||
|
||||
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.utils import object_list
|
||||
from peewee import *
|
||||
@@ -169,13 +169,9 @@ def addingbookmark(userkey):
|
||||
# abort(404)
|
||||
|
||||
if request.method == 'POST':
|
||||
print request
|
||||
print request.form
|
||||
title = request.form['title']
|
||||
print title
|
||||
url = request.form['url']
|
||||
tags = request.form['tags']
|
||||
print url
|
||||
if url:
|
||||
bookmark = Bookmark(url=url, title=title, tags=tags, userkey=userkey)
|
||||
bookmark.sethash()
|
||||
@@ -184,7 +180,8 @@ def addingbookmark(userkey):
|
||||
# Title was empty, automatically fetch it from the url
|
||||
bookmark.get_title_from_source()
|
||||
bookmark.save()
|
||||
return redirect(url)
|
||||
#return redirect(url)
|
||||
return redirect(url_for('editbookmark', userkey=userkey, urlhash=bookmark.url_hash))
|
||||
abort(404)
|
||||
return redirect(url_for('add'))
|
||||
|
||||
|
||||
@@ -8,36 +8,30 @@
|
||||
|
||||
<div class="input-field col s12">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="input-field col s12">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="input-field col s12">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="input-field col s12">
|
||||
{#<i class="material-icons prefix">star</i>#}
|
||||
<div class="switch">
|
||||
<label>
|
||||
Normal
|
||||
<input type="checkbox" id="starred">
|
||||
<span class="lever"></span>
|
||||
Starred
|
||||
</label>
|
||||
</div>
|
||||
<input type="checkbox" name="starred" id="starred" />
|
||||
<label for="starred">Starred</label>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
{# <input type="submit" value="Save" /> #}
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user