예제 #1
0
    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.conf.urls import url
from django.contrib import admin
from django.conf.urls import include
from django.urls import reverse
from rango import views
from django.conf import settings
from django.conf.urls.static import static
from registration.backends.simple.views import RegistrationView
from rango.views import IndexView


class MyRegistrationView(RegistrationView):
    def get_success_url(self, user):
        return reverse('rango:register_profile')


urlpatterns = [
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^rango/', include('rango.urls')),
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/register/$',
        MyRegistrationView.as_view(),
        name='registration_register'),
    url(r'^accounts/', include('registration.backends.simple.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
예제 #2
0
from django.urls import path
from rango.views import AboutView, AddCategoryView, \
    IndexView, AddPageView, RestrictedView, ShowCategoryView, \
    GotoUrlView, RegisterProfileView, ProfileView, ListProfileView, \
    LikeCategoryView, CategorySuggestionView, AddPageSearchView

app_name = 'rango'

urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('about/', AboutView.as_view(), name='about'),
    path('category/<slug:category_name_slug>/',
         ShowCategoryView.as_view(),
         name='show_category'),
    path('add_category/', AddCategoryView.as_view(), name='add_category'),
    path('category/<slug:category_name_slug>/add_page/',
         AddPageView.as_view(),
         name='add_page'),
    path('restricted/', RestrictedView.as_view(), name='restricted'),
    path('goto/', GotoUrlView.as_view(), name='goto'),
    path('register_profile/',
         RegisterProfileView.as_view(),
         name='register_profile'),
    path('profile/<username>/', ProfileView.as_view(), name='profile'),
    path('profiles/', ListProfileView.as_view(), name='list_profiles'),
    path('like_category/', LikeCategoryView.as_view(), name='like_category'),
    path('suggest/', CategorySuggestionView.as_view(), name='suggest'),
    path('search_add_page/',
         AddPageSearchView.as_view(),
         name='search_add_page'),
]