Remember: the idea is that you can do the reading whenever you have time. The quizzes are meant to be done separately. In fact, it's better, pedagogically, to quiz yourself a bit later than when you did the reading.
I'm not sure what you mean by "at your own pace". The quizzes are intended to be short. Over half the class did this one in less than 5 minutes, which is what I intend. Several did it in less than a minute. I allow 30 because I don't want you to feel time pressure, and I know that some folks get 1.5x time on quizzes, so 30 minutes seemed more than sufficient.
But I don't want people to open the exam, read over the questions, and Control-F for the answers. I know people do that anyhow, but still.
Let me return to the other half of your question: why not release them all at the beginning of the semester? I have several reasons:
But let's take a poll: how many would like me to release all the quizzes for the rest of the semester now?
Sure. Here's the question:
If we POST a form with the empty string for the ACTION, the data goes A. to the same handler as sent the form B. to the home page C. to the index page D. to the url specified by the processor variable
A few years ago, I thought it was useful/interesting to have an empty string for the ACTION, which allows for forms that could be used in different contexts.
But later, I learned that such an action can create a web vulnerability.
So, rather than completely eliminate such examples, I decided to
keep that in the reading and explicitly warn against using ACTION=""
Apparently, I've confused some of you, and I apologize for that. I'll revised the reading for next year.
Always. You should always specify the url for the ACTION in template.
We don't want to go to the current URL.
Sure. Here's a link to the flask-starter code
Well, the flask-starter
directory has
an app.py
file in it that has all the
necessary import
statements and such to get us
started. That's actually the most useful thing, in my opinion.
You can use your own HTML/CSS/JS, maybe from Bootstrap or something.
You can have a replaceable block that adds another CSS file
or style
tag. You could even put CSS directly into the
HTML, but that's considered poor style.
The parent determines what can/can't be changed. So the child can always inherit, though if the child doesn't replace anything, it's not really useful.
The render_template
command chooses the template to
render. If there are 17 child templates that inherit from a single
base template, there are 18 choices.
The child determines which blocks are replaced.
We would almost never want to re-submit data if POST is being used properly, because POST should be updating/modifying the state of the application or the database, and we rarely want to do that in the same way with the same data.
However, sometimes, people mis-use POST. The example in the reading is LTS's classlist application.
In that case, people might want to re-submit.
In any event, the Post-Redirect-Get pattern puts the browser at a page where reload will be a GET request, which is harmless to reload.
Doesn't matter. Create the routes you need and want, and don't worry about the number.
@app.route('/ask_city/', methods=['GET','POST']) def ask_city(): if request.method == 'GET': return render_template( 'city_form.html', cities=countries.known.keys()) else: city = request.form.get('city') # redirect is a new import from flask return redirect(url_for('country',city=city))Can you go over how the POST-redirect-GET is used in the Flask route above? "
Sure. The first branch sends a page with a blank form. The second branch processes a filled out form and redirects to the country page.
I'm glad to answer questions then.
I briefly considered Django, but it seemed more complicated than Flask.
Let's do it!