from django.urls import path from pages.views import HomePageView, AboutPageView urlpatterns = [ path('about/', AboutPageView.as_view(), name="about"), path('', HomePageView.as_view(), name="home") ]
def test_aboutpage_url_resolves_aboutpageview(self): view = resolve('/about/') self.assertEqual(view.func.__name__, AboutPageView.as_view().__name__)
from django.urls import path from pages.views import HomePageView, AboutPageView, ContactsPageView urlpatterns = [ path('', HomePageView.as_view(), name='home'), path('about/', AboutPageView.as_view(), name='about'), path('contacts/', ContactsPageView.as_view(), name='contacts') ]
def test_about_page_resolve_aboutpageview(self): view = resolve(reverse('pages:about')) self.assertEqual(view.func.__name__, AboutPageView.as_view().__name__)
from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.contrib import admin from pages.views import HomePageView, AboutPageView, ContactPageView, FAQPageView admin.autodiscover() urlpatterns = patterns( '', url(r'^$', HomePageView.as_view(), name="home"), url(r'^about/$', AboutPageView.as_view(), name="about"), url(r'^contact/$', ContactPageView.as_view(), name="contact"), url(r'^faq/$', FAQPageView.as_view(), name="faq"), url(r'^admin/', include(admin.site.urls)), # User management url(r'^users/', include('users.urls', namespace='users')), url(r'^accounts/', include('allauth.urls')), # Avatars url(r'^avatar/', include('avatar.urls')), # Manage Things url(r'^things/', include('things.urls', namespace='things')), # Hijack urls
from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from recipes.views import RecipeListView from pages.views import AboutPageView urlpatterns = [ path('all-about-admin/', admin.site.urls), path("", RecipeListView.as_view(), name="recipe_list"), path("about/", AboutPageView.as_view(), name="about"), path('accounts/', include('django.contrib.auth.urls')), path('accounts/', include('accounts.urls')), path('recipes/', include('recipes.urls')), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)