In order to process requests to add a property, we need to define a route to the appropriate view. This is accomplished in the urls.py file. The main website routes are defined in the project's urls.py file, found in the /path/to/repo/www/chapter_08/booksomeplace_dj directory. Also note the added entry for the property app:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('booking/', include('booking.urls')),
path('property/', include('property.urls')),
path('', include('home.urls')),
]
In the property/urls.py file, each entry also uses the special path() function, which takes three arguments:
- The URL fragment that is appended to /property
- The view method to be called if this URL is matched
- A key that is assigned to this route
In order to add a new property, from the client we...