from links.views import UpvoteSubmissionView from links.views import RemoveUpvoteFromSubmissionView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomeView.as_view(), name='home'), url(r'^login/$', login, kwargs={'template_name': 'login.html'}, name='login'), url(r'^logout/$', logout, kwargs={'next_page': '/login/'}, name='logout'), url(r'^register/$', UserRegistrationView.as_view(), name='user-registration'), url(r'^new-submission/$', NewSubmissionView.as_view(), name='new-submission'), url(r'^submission/(?P<pk>\d+)/$', SubmissionDetailView.as_view(), name='submission-detail'), url(r'new-comment/$', NewCommentView.as_view(), name='new-comment'), url(r'new-comment-reply/$', NewCommentReplyView.as_view(), name='new-comment-reply'), url(r'^upvote/(?P<link_pk>\d+)/$', UpvoteSubmissionView.as_view(), name='upvote-submission'), url(r'^upvote/(?P<link_pk>\d+)/remove/$', RemoveUpvoteFromSubmissionView.as_view(), name='remove-upvote'), ]
from django.contrib.auth.views import logout from django.views.generic import TemplateView from accounts.views import UserRegistrationView from links.views import HomeView from links.views import NewSubmissionView from links.views import SubmissionDetailView from links.views import NewCommentView from links.views import NewCommentReplyView from links.views import UpvoteSubmissionView from links.views import RemoveUpvoteFromSubmissionView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomeView.as_view(), name='home'), url(r'^login/$', login, kwargs={'template_name': 'login.html'}, name='login'), url(r'^logout/$', logout, kwargs={'next_page': '/login/'}, name='logout'), url(r'^register/$', UserRegistrationView.as_view(), name='user-registration'), url(r'^new-submission/$', NewSubmissionView.as_view(), name='new-submission'), url(r'^submission/(?P<pk>\d+)/$', SubmissionDetailView.as_view(), name='submission-detail'), url(r'new-comment/$', NewCommentView.as_view(), name='new-comment'), url(r'new-comment-reply/$', NewCommentReplyView.as_view(), name='new-comment-reply'), url(r'^upvote/(?P<link_pk>\d+)/$', UpvoteSubmissionView.as_view(), name='upvote-submission'), url(r'^upvote/(?P<link_pk>\d+)/remove/$', RemoveUpvoteFromSubmissionView.as_view(), name='remove-upvote'), ]
from django.contrib.auth.views import login from django.contrib.auth.views import logout from django.views.generic import TemplateView from accounts.views import UserRegistrationView from links.views import HomeView from links.views import NewSubmissionView from links.views import SubmissionDetailView from links.views import NewCommentView from links.views import NewCommentReplyView from links.views import UpvoteSubmissionView from links.views import RemoveUpvoteFromSubmissionView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomeView.as_view(), name='home'), url(r'^login/$', login, kwargs={'template_name': 'login.html'}, name='login'), url(r'^logout/$', logout, kwargs={'next_page': '/login/'}, name='logout'), url(r'^register/$', UserRegistrationView.as_view(), name='user-registration'), url(r'^new-submission/$', NewSubmissionView.as_view(), name='new-submission'), url(r'^submission/(?P<pk>\d+)/$', SubmissionDetailView.as_view(), name='submission-detail'), url(r'new-comment/$', NewCommentView.as_view(), name='new-comment'), url(r'new-comment-reply/$', NewCommentReplyView.as_view(), name='new-comment-reply'), url(r'^upvote/(?P<link_pk>\d+)/$', UpvoteSubmissionView.as_view(), name='upvote-submission'), url(r'^upvote/(?P<link_pk>\d+)/remove/$', RemoveUpvoteFromSubmissionView.as_view(), name='remove-upvote'), ]
2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from accounts.views import UserRegistrationView from django.views.generic import TemplateView from django.contrib.auth.views import LoginView, LogoutView from links.views import NewSubmissionView, SubmissionDetailView, NewCommentView from links.views import AllLinkListView, NewCommentReplyView from links.views import UpvoteSubmissionView, RemoveUpvoteFromSubmissionView urlpatterns = [ path('admin/', admin.site.urls), path('', AllLinkListView.as_view(), name='home'), path('new-user/', UserRegistrationView.as_view(), name='user-registration'), path('login/', LoginView.as_view(template_name='accounts/login.html'), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('new-submission/', NewSubmissionView.as_view(), name='new-submission'), path('submission/<int:pk>/', SubmissionDetailView.as_view(), name='submission-detail'), path('new-comment/', NewCommentView.as_view(), name='new-comment'), path('new-comment-reply/', NewCommentReplyView.as_view(), name='new-comment-reply'), path('upvote/<int:link_pk>/', UpvoteSubmissionView.as_view(), name='upvote-submission'), path('upvote/<int:link_pk>/remove/', RemoveUpvoteFromSubmissionView.as_view(), name='remove-upvote'), ]