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

Disable users to create subjects by themselves. #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions service.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ def find_subjects(subject, count):
# ================================================================================
@app.route('/edit_subcategory', methods=['GET', 'POST'])
def add_sub_category():
if not session.get('logged_in'):
return render_template('login.html')
if request.method == 'POST':
subject_id = request.form['subject_id']
subject_name = request.form['subject_name']
Expand Down
5 changes: 3 additions & 2 deletions templates/subject.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@
<div class="card-body">
<p class="card-text">You are in {{ url }}</p>
<form name="myform" method="get" onsubmit="return verify();">
<input type="text" name="subject_id" style="display: none" value={{ subject_id }}>
<input type="email" name="email" id="email" placeholder="Enter Email to post or create" required="required"/><br><br>
Copy link
Member Author

@spm2020spring spm2020spring Dec 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GenjiLemon

Why did you remove this line (i.e., line 63)?

-Hui

<input type="text" name="subject_id" style="display: none" value={{ subject_id }}><br>
<button type="submit" class="btn btn-primary" onclick="postArticle()">post article</button>
{% if session.get('logged_in') %}
<button type="submit" class="btn btn-primary" onclick="createSubject()">add subcategory</button>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GenjiLemon

What is createSubject()? A JavaScript function?

-Hui

<input type="checkbox" name="add_father" value="father" /> add main subject
{% endif %}
</form>
</div>
</div><br>
Expand Down