From 64d035150c0369866d0a719b33560464479cdd0c Mon Sep 17 00:00:00 2001 From: Cristina Cochior Date: Wed, 17 Apr 2019 14:44:14 +0200 Subject: [PATCH 1/2] fixed diverge template --- __pycache__/contextualise.cpython-36.pyc | Bin 3024 -> 3027 bytes contextualise.py | 2 +- templates/diverge.html | 16 ++++++++--- wordlist_v3.json | 35 +++++++++++++++++++++++ 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 wordlist_v3.json diff --git a/__pycache__/contextualise.cpython-36.pyc b/__pycache__/contextualise.cpython-36.pyc index 5824120038f80fccb046e681346b913410011170..fb862dbdeac2f8bd99670a1d5968dc04ea368d09 100644 GIT binary patch delta 36 rcmca0ep#H;n3tEUKw^80+(u3|79N4}{Gybc%;J*xGULq>EIZf%!6pjX delta 33 pcmcaCenFhmn3tF9%fGEL(i=J1SU7ph^NUh)GK)(#OS9}?2LQoV3o`%! diff --git a/contextualise.py b/contextualise.py index c351efa..ecfe83c 100644 --- a/contextualise.py +++ b/contextualise.py @@ -35,7 +35,7 @@ pathofwords = [] pathofnumbers = [] #reading wordlist.json -with open('wordlist.json', 'r') as f: +with open('wordlist_v3.json', 'r') as f: wordlist_dict = json.load(f) diff --git a/templates/diverge.html b/templates/diverge.html index f10004c..6150ae9 100644 --- a/templates/diverge.html +++ b/templates/diverge.html @@ -1,11 +1,19 @@ {% extends "layout.html" %} {% block content %} -

test

-

{{ searchterm }}

+

{{ searchterm }} :

{% for word in wordlist_dict %} - {% if word==searchterm %} - {{word[0]['way']}} + {% if searchterm == word %} + {% set length_d = wordlist_dict[word]|length %} + + {% for item in wordlist_dict[word] %} + {% set address = "/description?id=" + item['id'] %} + + {{ item['sentence'] }} +
+ {% endfor %} + {% endif %} {% endfor %} + {% endblock %} diff --git a/wordlist_v3.json b/wordlist_v3.json new file mode 100644 index 0000000..8838805 --- /dev/null +++ b/wordlist_v3.json @@ -0,0 +1,35 @@ +{ +"way" : [ + { + "id" : "17", + "sentence" : "He described his own art as a way of 'ensuring that the details of everyday life, the random constellations of objects that surround us, stop going unnoticed.'" + }, + + { + "id" : "17", + "sentence" : "Another sentence like way way this." + }, + + { + "id" : "00", + "sentence" : "Our ambition, and that of our collaborating partners, is to emancipate graphic notation from the confines of the modernist tradition, in such a way that it may remain an innovative and provocative medium for decades to come." + } +], + +"artwork" : [ + { + "id" : "17", + "sentence" : "One of the originators of 'participatory' art, in which the artwork can only be experienced by the active involvement of the viewer, he is most famous for his Event Scores such as Drip Music 1962, and is widely seen as an important precursor to conceptual art." + }, + { + "id" : "00", + "sentence" : "It unfolds through a nomadic program which includes the creation of newly commissioned artworks and public events that addres scontemporary questions and issues in this particular field." + }, + { + "id" : "00", + "sentence" : "The discursive program for 2016–2017 will include lectures, presentations of newly commissioned artworks, concert evenings, and workshops." + } + +] + +} From 7f455de9ae92c6654a2c7388ccdde0c8da8c0fb5 Mon Sep 17 00:00:00 2001 From: Cristina Cochior Date: Wed, 17 Apr 2019 17:03:38 +0200 Subject: [PATCH 2/2] new stuff --- __pycache__/contextualise.cpython-36.pyc | Bin 3027 -> 3030 bytes contextualise.py | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/__pycache__/contextualise.cpython-36.pyc b/__pycache__/contextualise.cpython-36.pyc index fb862dbdeac2f8bd99670a1d5968dc04ea368d09..c236f3aa9b27672545769adeaea923354926d469 100644 GIT binary patch delta 1543 zcmZWo&u<$=6rS0g^{zK|;<{;UCr+Bg`Q@aILt8?MLKKN|0u^WwMoYjrc@wi6$8KiV ztre~1NG>-*gZ2U(+6#x?K|R=>wjH%-mMX962AhUf&obNl*cJ+nkSqYKHa0%Y?%Oi zpWGuKk@j~y>CEwLkKQ4le7UJwS*vKxw-5O|j@#A(UvRF$r5;U?V=6w3M(LNMq?2{7 z^DJNJDb^y-J0+<@2_JE~CB6ukfqkLmNJPDmL6HP5cs4DEY3E{(>3*V2_Wvo9_Gf3z z-Fs>7PGoNN)EuflJFnX1|C8mzav^C37kE~d_)VGcC7z26F2SH|ZDPH`2b~*mrAJ{1 zGLO){bu(gcZ;*rGh`ALpBgo`oG-6(jm@#Co!uX@xGHp4cCSbBgp>U+Y6ii2xHPa0QY`-PrxK$LB{!L54r|k7u7VlSNgD0$# zd|O_%f$PMKWr&Uf)38H4unmP(xue= zZukuAcBiBJx)bXWM~8Tiio-}kmrH^PeMjo!)sEsTj?p6>4H6v#lD>hn{b*CR186hu z#U0Z({J5|6R5a0tE$wKh*7gs}1V?vYIQ0^c@|hp=HJ`wxBMt8|eK%BWIEcw(bxR_H z2Xt_9sRz32RXuyVB(5MCYEgvf$9~}IWy*r*`uJ$bY-lu#NukRaRuwfjRBPM|S@S** zOk<^MiUpjqhGd;ciJhhZ?rsbFzGpWZA>Fa!Q1z-6u(v%ihoNF#LQz5zRA*ILT%*cwq0Y{7v6; zdOTCXi+!Z3_{j<+`NGJ%XDG6v%k z*_6lxB9kyBk=G?MjYt7zB=UwtW?`;QVg5{k1t?1VO*RON2grMfh58g;#z zXYH+qy4)1}pv?utS|*am0pt0gtW{GVidj>T5QUEf-)is8UmB%{Aj3#Py|&wIc@I&1 zd*Nms=rV#qNWoRn>H`Ph!j6`@{fUK~=s>T5oMzBAFp{ttK`-r%|^dXg0<)I1+l#-$e1u{ zVhYUommqa>&6^2T#QT^8FCM>X$pb6?!pHB*<0 z(>mN`+~rHct1QThAmSoep<3g>jJmB|Jjj)m?}VCDJ7j!K+U=(0gvNfW(GbDHNbLx_ z0K6cLvgUV$sB?S^jE|tqMGfTu^GzYi`>VX=^pr~$PL98^b=ZVfgS|!3*L9EtUSe6v nsKGah+`@Qth{kD>_R%yQ5^qD*)B!}&_)5|m{;_l>r^o5P5QBP- diff --git a/contextualise.py b/contextualise.py index ecfe83c..2a0706c 100644 --- a/contextualise.py +++ b/contextualise.py @@ -26,10 +26,6 @@ listofdicts=[] #to be able to import and use json content datafromjson = [] -#test getting json file from id -id = "17" -jsonfilefordescription = "files/"+id+"/"+id+".json" - #arrays with the user path of words and numbers pathofwords = [] pathofnumbers = [] @@ -71,10 +67,10 @@ print("-------------------------") dict = {} #dict for the form entries -with open("static/"+jsonfilefordescription, 'r') as f: - data_dict = json.load(f) - datafromjson = data_dict["files"] -print(datafromjson) +# with open("static/"+jsonfilefordescription, 'r') as f: +# data_dict = json.load(f) +# datafromjson = data_dict["files"] +# print(datafromjson) @app.route("/") def home(): @@ -95,6 +91,11 @@ def all(): @app.route('/description') def description(): + idno=request.args.get('id') + jsonfilefordescription = "files/"+idno+"/"+idno+".json" + with open("static/"+jsonfilefordescription, 'r') as f: + data_dict = json.load(f) + datafromjson = data_dict["files"] #open json file, list filepaths in array and loop with thefile textfile="" with open("static/"+jsonfilefordescription, 'r') as f: @@ -111,7 +112,7 @@ def description(): textfile = Markup(textfile) - return render_template('description.html', datafromjson=datafromjson, itemid=itemid, textfile=textfile) + return render_template('description.html', datafromjson=datafromjson, itemid=itemid, textfile=textfile, idno=idno) @app.route('/diverge', methods=['GET']) def diverge():