11.3.2 Contact URL Pattern and View

With a form to work with, we can move straight into building a view and a URL pattern to interact with the form. We anticipate building a class-based view (CBV) called ContactView and therefore create a new file /contact/urls.py to house our URL configuration, as shown in Example 11.9.

Example 11.9: Project Code

contact/urls.py in 3969d84738

1  from django.conf.urls import url 2  from .views import ContactView 3 4 5  urlpatterns = [ 6      url(r'^$', 7          ContactView.as_view(), 8          name='contact'), 9  ]

We need to point our root URL configuration to this new file, as shown in Example 11.10.

Example 11.10: Project Code

suorganizer/urls.py in 3969d84738

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.