The Account List can be accessed at /account/list/ URL. When this page is accessed it will show a list of the authenticated user's accounts. In this step you'll create the URL configuration to enable that to happen.
/.../crmeasy/crmapp/urls.py. First, import the AccountList view by adding this to the top of the file:
from accounts.views import AccountList
Then add the following code to the URL configuration (below the '# Account related URLs' comment):
1 2 3 4
# Account related URLs url(r'^account/list/$', AccountList.as_view(), name='account_list' ),
Line 1: This should look familiar as it follows the same pattern as the Subscriber URL conf. The
url() function is passed three arguments. The first argument is
r'^account/list/$' which is a regular expression that defines what the URL path is. The second argument is
AccountList.as_view() which is the CBV that we want the request to be passed to. The last argument is
name='account_list' which is a friendly name that we an access the URL configuration by.
Execute these commands to commit your changes in Git.
1 2 3 4 5
# add files (venv)$ git add . # commit files (venv)$ git commit -m "created account list URL"