diasporadiaries

a platform for writing stories with personal accounts and messages
git clone git://parazyd.org/diasporadiaries.git
Log | Files | Refs | Submodules | README | LICENSE

commit 1cb9767cc714def2efac696286530278b723a73d
parent 1e98e787da7d72f045272344bf0dc04df8f9874f
Author: parazyd <parazyd@dyne.org>
Date:   Sun, 27 Jan 2019 17:54:45 +0100

Add an about field in the stories database.

Diffstat:
Mdb.py | 7++++---
Mdiaspora.py | 2++
Mtemplates/write.html | 4++++
Mutils.py | 11++++++-----
4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/db.py b/db.py @@ -51,6 +51,7 @@ def initdb(dbpath): disembark text NOT NULL, email text, city text, + about text, story text NOT NULL, timestamp integer NOT NULL, visible integer NOT NULL, @@ -123,14 +124,14 @@ def sql_insert(args): """ # TODO: Make this more generic. sem.acquire() - if len(args) == 11: + if len(args) == 12: # Story DB.execute(""" INSERT INTO stories VALUES ( - ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? + ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ); """, (args[0], args[1], args[2], args[3], args[4], args[5], - args[6], args[7], args[8], args[9], args[10])) + args[6], args[7], args[8], args[9], args[10], args[11])) elif len(args) == 7: # User DB.execute(""" diff --git a/diaspora.py b/diaspora.py @@ -252,6 +252,7 @@ def write(): request.form.get('Disembark', 'nn'), request.form.get('Email'), request.form.get('City'), + request.form.get('About'), request.form.get('Story', 'foobar'), int(time()), 0, @@ -291,6 +292,7 @@ def edit(): ('email', request.form.get('Email')), ('city', request.form.get('City')), ('story', request.form.get('Story', 'foo')), + ('about', request.form.get('About')), ('abstract', request.form.get('Abstract', 'foo')), ] diff --git a/templates/write.html b/templates/write.html @@ -59,6 +59,10 @@ <input type="text" name="42" placeholder="Yeah sure" style="display: none;"> + <p class="lead">About you:<br> + <textarea class="form-control" name="About" form="storyform" placeholder="Reasons for moving, etc..."></textarea> + </p> + <p class="lead">Write your story:<br> <textarea class="form-control" id="storytext" name="Story" form="storyform" required></textarea> </p> diff --git a/utils.py b/utils.py @@ -71,11 +71,12 @@ def fill_story(row): 'disembarkname': getcountryname(row[3]), 'email': row[4], 'city': row[5], - 'story': row[6], - 'time': row[7], - 'visible': row[8], - 'deletekey': row[9], - 'abstract': row[10], + 'about': row[6], + 'story': row[7], + 'time': row[8], + 'visible': row[9], + 'deletekey': row[10], + 'abstract': row[11], }