the definition of new_entry(has topic_id parameter to store the value it receives from the url we'll need the topic to render the page and process the form' dataso we use topic_id to get the correct topic object at at we check if the request method is post or get the if block executes if it' get requestand we create blank instance of entryform if the request method is postwe process the data by making an instance of entryformpopulated with the post data from the request object we then check if the form is valid if it iswe need to set the entry object' topic attribute before saving it to the database when we call save()we include the argument commit=false to tell django to create new entry object and store it in new_entry without saving it to the database yet we set new_entry' topic attribute to the topic we pulled from the database at the beginning of the function zand then we call save(with no arguments this saves the entry to the database with the correct associated topic at we redirect the user to the topic page the reverse(call requires two arguments--the name of the url pattern we want to generate url for and an args list containing any arguments that need to be included in the url the args list has one item in ittopic_id the httpresponseredirect(call then redirects the user to the topic page they made an entry forand they should see their new entry in the list of entries the new_entry template as you can see in the following codethe template for new_entry is similar to the template for new_topicnew_entry html {extends "learning_logs/base html%{block content % {topic }add new entry{csrf_token %{form as_p }add entry {endblock content %we show the topic at the top of the page uso the user can see which topic they're adding an entry to this also acts as link back to the main page for that topic the form' action argument includes the topic_id value in the urlso the view function can associate the new entry with the correct topic other than thatthis template looks just like new_topic html