chess ll_admin rock climbing ll_admin we import topic from learning_logs models and then loop through all existing topicsprinting each topic and the user it belongs to you can see that each topic now belongs to the user ll_admin note you can simply reset the database instead of migratingbut that will lose all existing data it' good practice to learn how to migrate database while maintaining the integrity of usersdata if you do want to start with fresh databaseissue the command python manage py flush to rebuild the database structure you'll have to create new superuserand all of your data will be gone restricting topics access to appropriate users currentlyif you're logged inyou'll be able to see all the topicsno matter which user you're logged in as we'll change that by showing users only the topics that belong to them make the following change to the topics(function in views pyviews py --snip-@login_required def topics(request)"""show all topics ""topics topic objects filter(owner=request userorder_by('date_added'context {'topics'topicsreturn render(request'learning_logs/topics html'context--snip-when user is logged inthe request object has request user attribute set that stores information about the user the code fragment topic objects filter(owner=request usertells django to retrieve only the topic objects from the database whose owner attribute matches the current user because we're not changing how the topics are displayedwe don' need to change the template for the topics page at all to see if this workslog in as the user you connected all existing topics toand go to the topics page you should see all the topics now log outand log back in as different user the topics page should list no topics protecting user' topics we haven' actually restricted access to the topic pages yetso any registered user could try bunch of urlslike and retrieve topic pages that happen to match try it yourself while logged in as the user that owns all topicscopy the url or note the id in the url of topicand then log out and log back in user accounts