Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peak wiki articles #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
started peak
siddhant2001 committed Nov 21, 2020
commit ccc4c8c5237eb6b981da80c0fad496f14d3d5dde
Binary file modified WikiWALK/WikiWALK/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file modified WikiWALK/WikiWALK/__pycache__/view.cpython-38.pyc
Binary file not shown.
11 changes: 11 additions & 0 deletions WikiWALK/WikiWALK/templates/index.html
Original file line number Diff line number Diff line change
@@ -84,6 +84,11 @@ <h2 class="card-title">
<a href="{% url 'forwards' next_link=var.LinkName %}">
{{ var.LinkName }}
</a>
<form method="POST"> {% csrf_token %}
<!-- <input type="text" class="form-control my-3" placeholder="Your Link" name='suggested_link'> -->
<input type="hidden" name="embed_link" value="{{ var.LinkName }}">
<input type="submit" value="Peek" />
</form>
</li>
{%endfor%}
</ul>
@@ -93,6 +98,12 @@ <h2 class="card-title">
</div>
</div>

<div>
http://en.wikipedia.org/wiki/{{ peakLink }}
<object type="text/html" data="http://en.wikipedia.org/wiki/{{ PeakLink }}" width="800px" height="600px" style="overflow:auto;border:5px ridge blue">
</object>
</div>

</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
9 changes: 8 additions & 1 deletion WikiWALK/WikiWALK/view.py
Original file line number Diff line number Diff line change
@@ -38,13 +38,20 @@ def createGameState(currentLink):


def nextLink(req, next_link):

peak_link = next_link

if req.POST.get('suggested_link'):
print(req.POST.get('suggested_link'))
print(next_link)
query = """INSERT INTO Suggestions (from_link, to_link) VALUES("%s", "%s")"""%(next_link, req.POST.get('suggested_link'))
cur_meta.execute(query)
conn_meta.commit()

if req.POST.get('embed_link'):
print(req.POST.get('embed_link'))
peak_link = req.POST.get('embed_link')
if next_link == endLink:
return render(req, "gameOver.html")
res = createGameState(next_link)
return render(req, "index.html", {"CurrentLink": next_link, "Link": res})
return render(req, "index.html", {"CurrentLink": next_link, "Link": res, "peakLink": peak_link})