Learn Django

Edit Account - Create URL Conf

While it's great that users can now create accounts, what if they need to edit the account name, or address? The next several lessons will show you how to update the application to allow for the editing of account details. The good news is that most of the structure is in place to allow this to happen. This lesson marks the beginning of the steps required to modify that functionality to allow users to edit existing accounts.

The first of those steps is to create a new URL configuration. This configuration will allow the application to display an edit form when /account/<uuid/edit/ is accessed.

Open /.../crmeasy/crmapp/accounts/urls.py and add the /edit/ URL conf to it.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from django.conf.urls import patterns, url

account_urls = patterns('',

    url(r'^$',
        'crmapp.accounts.views.account_detail', name='account_detail'
    ),
    url(r'^edit/$',
        'crmapp.accounts.views.account_cru', name='account_update'
    ),

)

Commit Changes

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 "added edit account URL"

Track your progress with a free account