Skip to content

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Forms #92

wants to merge 4 commits into from

Conversation

genovese28
Copy link

No description provided.

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"])
Copy link
Contributor

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

Copy link
Contributor

@elie elie left a 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"])
Copy link
Contributor

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}}>
Copy link
Contributor

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}}">
Copy link
Contributor

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">
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants