What I want to do is to pass the dates inside the parameter of a function, then process the input. Here's the function for it
@HR.route('/confirm_sickLeave/<date>/<user>', methods=['GET', 'POST'])
def confirm_sickLeave(user,date):
u = User.query.filter_by(username=user.username).first()
print u
us = UserStatistics.filter_by(userId=u.id).first()
temp = us.slDates
dates = temp.keys()
for a in dates:
if a == date:
temp['date'] = True
flash('Date Confirmed.')
return redirect(url_for('.approval_of_leaves'))
return redirect(url_for('.approval_of_leaves'))
Now, my problem was I can't pass the values in my function. The reason was my input dates had slashes (/) in it. Let me show you:
HTML:
{% for u in all_users %}
## Returns all the dates applied by the user (it's in dict format)
{% set user_info = u.return_sickLeaves(u.username) %}
{% for us in user_info %}
<tr>
<td> {{ u.username }} </td>
<td> {{ us|e }} </td>
{% if us.value|e == True %}
<td class="success">Confirmed</td>
{% else %}
<td class="warning">Pending..</td>
{% endif %}
<td><a href = "{{ url_for('HR.confirm_sickLeave', user=u.username, date= us|e) }}">Confirm</a>
<a href = "#">Deny</a>
</td>
{% endfor %}
</tr>
{% endfor %}
Now, when I try to click confirm button, the response that I get is Error 404 not found. The url of the 404 error is: http://localhost:5000/confirm_sickLeave/02/01/2015%3B02/02/2015/seer
Is there any alternatives I can do? Thank you for you contribution. :)
2015-02-02.