From 6ebbaf9af3b9906f665f5fa43eb09e99485884f3 Mon Sep 17 00:00:00 2001 From: TsimpDim Date: Mon, 4 Jun 2018 10:49:33 +0300 Subject: [PATCH] Added newlines in the Note field --- _3RStore/templates/resources.html | 8 +++++--- _3RStore/views.py | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/_3RStore/templates/resources.html b/_3RStore/templates/resources.html index 19b0eb2..c6afb4f 100644 --- a/_3RStore/templates/resources.html +++ b/_3RStore/templates/resources.html @@ -94,11 +94,13 @@

{{re.title}}

{% if re.note %} {% endif %} diff --git a/_3RStore/views.py b/_3RStore/views.py index cb892da..23ce76c 100644 --- a/_3RStore/views.py +++ b/_3RStore/views.py @@ -252,7 +252,7 @@ def add_resource(): if request.method == 'POST' and form.validate(): title = form.title.data link = parse.unquote(form.link.data) - note = form.note.data + note = form.note.data.replace('\n','
') # So we can show the newlines in the note section timestamp = datetime.datetime.fromtimestamp( time()).strftime('%Y-%m-%d %H:%M:%S') @@ -344,7 +344,7 @@ def edit_res(user_id, re_id): form = forms.ResourceForm() form.title.data = data[0]['title'] form.link.data = data[0]['link'] - form.note.data = data[0]['note'] + form.note.data = data[0]['note'].replace('
','\n') # Else the
tags will display as text if data[0]['tags']: form.tags.data = ','.join(data[0]['tags']) # Array to string @@ -362,7 +362,7 @@ def edit_res(user_id, re_id): # Grab the new form and its data title = form.title.data link = form.link.data - note = form.note.data + note = form.note.data.replace('\n','
') # Save newlines as
to display them properly later tags = form.tags.data # If not empty format for proper insertion into postgresql