Assignment: Build a Blog (Use Case 2)


#1

Hi everyone,

I’ve completed everything for Build a Blog except Use Case 2, where we set the add a blog post page up for redirecting/rendering an individual blog entry’s page after it is submitted. The instructions hint that it requires grabbing the id after it has been created after the commit, but I’ve been struggling with what query to use and how to past the id as a parameter. Does anyone have advice on how to approach this?


#2

Big Hint:
Remember format
‘’'def sumProblemString(x, y):
sum = x + y
return ‘The sum of {} and {} is {}.’.format(x, y, sum)

def main():
print(sumProblemString(2, 3))
print(sumProblemString(1234567890123, 535790269358))
a = int(input("Enter an integer: "))
b = int(input("Enter another integer: "))
print(sumProblemString(a, b))

main() ‘’’

In build-a-blog you have a list of posts, you need to link them so they display on a page. how are you going to distinguish one from the other in a one line url link call?


#3

You can think of it as passing another variable in to the html code-- in this case it would simply be the code for setting up the link. You will just have to establish what code to add to the “/Blog?id=” link syntax to create the correct relationship between the link and the user id.


#4

Format worked! I heard that we could loop through URL’s, but I didn’t know it worked that way with format. Thank you both for your help!