-
Notifications
You must be signed in to change notification settings - Fork 31
Forms #92
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
base: master
Are you sure you want to change the base?
Forms #92
Conversation
return redirect(url_for('messages_index', user_id=user_id)) | ||
return render_template('messages/index.html', user=User.query.get(user_id)) | ||
|
||
@app.route('/users/<int:user_id>/messages/new', methods=["GET", "POST"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't need to have a methods=["GET", "POST"]
- that was a mistake in the screencast :) - we just need "GET" here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, but you have to use the forms you create on the server in your HTML templates - please see my comments and fix this up
def messages_new(user_id): | ||
return render_template('messages/new.html', user=User.query.get(user_id)) | ||
|
||
@app.route('/users/<int:user_id>/messages/<int:id>/edit', methods=["GET", "POST"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
{% block content %} | ||
<h1>Edit a new message</h1> | ||
<form method="POST" action="{{url_for('messages_show', user_id=message.user.id, id=message.id)}}?_method=PATCH"> | ||
<input type="text" name="content" value={{message.content}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is your WTForm? You should not be using input
tags here
|
||
<h1>Add a new user!</h1> | ||
<form method="POST" action="{{url_for('show', id=user.id)}}?_method=PATCH" > | ||
<input type="text" name="first_name" value="{{user.first_name}}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is your WTForm? You should not be using input
tags here
{% block content %} | ||
<h1>Add a new message</h1> | ||
<form method="POST" action="{{url_for('messages_index', user_id=user.id)}}"> | ||
<input type="text" name="content"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is your WTForm? You should not be using input
tags here
No description provided.