Setting Up the URL Pattern and View
We need to handle the /createPost
URL And link it up to a view that supports the POST request. We do this the same way we've been doing it all along!
We can simply add the following URL:
url(r'^createPost', CreatePost.as_view())
Thus we need to create the CreatePost view in views.py (empty for now):
class CreatePost(View):
def post(self, request):
pass
And finally we should import CreatePost in our urls.py
from instaclone.views import HomePage, PostPage, CreatePost
Now that we have that setup, let's actually put some code in our CreatePost view so it can do something!