def setUp(self): book = BookFactory.create() self.user = UserFactory.create(username='******') bookowner = BookOwnerFactory.create(user=self.user,book=book) request_factory = RequestFactory() request = request_factory.get(reverse('profile')) request.user = self.user request.current_book = book self.response = ProfileView.as_view()(request)
from django.conf.urls import url from profiles.views import ProfileView, profile_edit, accept_terms, ProfileTimelineView app_name = 'profiles' urlpatterns = [ # ex: .com/profile/view/21/ url(r'^view/(?P<pk>[\d]+)/$', ProfileView.as_view(), name='profiles_view_profile'), # ex: .com/profile/view-timeline/21/ url(r'^view-timeline/(?P<pk>[\d]+)/$', ProfileTimelineView.as_view(), name='profiles_timeline'), # ex: .com/profile/edit url(r'^edit/$', profile_edit, name='profiles_edit'), # ex: .com/profile/terms/ url(r'^terms/$', accept_terms, name='profiles_terms'), ]
from django.conf.urls import patterns, include, url from django.contrib import admin from profiles.views import ProfileView admin.autodiscover() urlpatterns = patterns('', (r'', include("social_auth.urls")), (r'', include("generic.urls")), (r"^messages/", include("carrier_pigeon.urls", namespace="pigeon")), url(r"^profile/$", ProfileView.as_view(), name="profile"), url(r"^admin/", include(admin.site.urls)), )
def setUp(self): request_factory = RequestFactory() request = request_factory.get(reverse('profile')) request.user = UserFactory.create() self.response = ProfileView.as_view()(request)
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 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.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from rest_framework_jwt.views import obtain_jwt_token, verify_jwt_token from profiles.views import ProfileView, ProfilesBasicsView, ProfileListView urlpatterns = [ path('admin/', admin.site.urls), path('api-auth/', include('rest_framework.urls')), path('api-token-auth/', obtain_jwt_token), path('api-token-verify/', verify_jwt_token), path('profiles', ProfileListView.as_view()), path('profiles/list', ProfilesBasicsView.as_view()), path('profiles/<user_id>', ProfileView.as_view()), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from . import views from django.conf import settings from django.conf.urls.static import static from . import views from profiles.views import ( ProfileView, Offical_Letter_View, Offical_Letter_Create_View, Offical_Letter_Detail_View, Offical_Letter_Update_View, Offical_Letter_Delete_View, Edit_Profile_View, Edit_profile_Update_View, MicroThoughtsSortView, ProductSortView, ArticleSortView, AddProductUpdateView, AddProductDeleteView, MicroThoughtsDeleteView, MicroThoughtsUpdateView, ArticleUpdateView, ArticleDeleteView) urlpatterns = [ path('<username>/', ProfileView.as_view(), name='profile'), #offical letter path('<username>/official_letter/', Offical_Letter_View.as_view(), name='offical-letter-view'), path('<username>/official_letter_form/', Offical_Letter_Create_View.as_view(), name='offical-letter-form'), path('<username>/official_letter/details/<int:id>/<slug:slug>', views.Offical_Letter_Detail_View, name='offical-letter-details-view'), path('official_letter/update/<int:pk>', Offical_Letter_Update_View.as_view(), name='offical-letter-update-view'), path('official_letter/delete/<int:pk>', Offical_Letter_Delete_View.as_view(),
from django.conf.urls import url from profiles.views import ProfileView urlpatterns = [ url(r'^$', ProfileView.as_view(), name='profile'), ]
OrderView, UserOrderView, ) from profiles.views import ( ProfileView, ) urlpatterns = [ url(r'^about/$', function_based_view), url(r'^article/(?P<slug>[\w-]+)/$', ArticleView.as_view()), url(r'^blog/(?P<year>\d{4})/$', YearArchiveView.as_view()), url(r'^blog/(?P<year>\d{4})/(?P<month>\d{2})/$', YearArchiveView.as_view()), url(r"^order/(?P<order>\d+)/$", OrderView.as_view()), url(r"^order/(?P<username>[\w.@+-]+)/(?P<order>\d+)/$", UserOrderView.as_view()), url(r'^profile/(?P<username>[\w.@+-]+)/$', ProfileView.as_view()), ] """ Django 1.5-1.8 Pattern Syntax """ from blog.views import ( ArticleView, YearArchiveView, MonthArchiveView, PostSlugView, PostIdView, )
from django.conf.urls.defaults import patterns, include, url from profiles.views import ProfileView urlpatterns = patterns( '', url(r'^$', ProfileView.as_view(), name='profiles_list'), url(r'^login/$', 'profiles.views.login', name='profiles_login'), )
from django.conf.urls import url from django.contrib import admin from profiles.views import LoginView, LogoutView, ProfileView, RegisterProfileView from voyage.views import (AddPortView, AddShipView, AddVoyageView, AddWaypointView, DeletePortView, DeleteShipView, DeleteVoyageView, DeleteWaypointView, IndexView, ModifyPortView, ModifyShipView, ModifyVoyageView, ModifyWaypointView, PortView, ShipView, VoyageView, WaypointView, PortsView, ShipsView, VoyagesView, WaypointsView) from meteo.views import MeteoView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^register/$', RegisterProfileView.as_view(), name='register'), url(r'^profile/(?P<pk>(\d)+)$', ProfileView.as_view(), name='profile'), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^index/$', IndexView.as_view(), name='index'), url(r'^ships/$', ShipsView.as_view(), name='ships'), url(r'^ship/(?P<pk>(\d)+)$', ShipView.as_view(), name='ship'), url(r'^add_ship/$', AddShipView.as_view(), name='add-ship'), url(r'^modify_ship/(?P<pk>(\d)+)/$', ModifyShipView.as_view(), name='modify-ship'), url(r'^delete_ship/(?P<pk>(\d)+)/$', DeleteShipView.as_view(), name='delete-ship'), url(r'^ports/$', PortsView.as_view(), name='ports'), url(r'^port/(?P<pk>(\d)+)$', PortView.as_view(), name='port'), url(r'^add_port/$', AddPortView.as_view(), name='add-port'),
from django.conf import settings from django.conf.urls.defaults import * from profiles.views import ProfileEdit, ProfileView, RegisterView urlpatterns = patterns('', url(r'^$', ProfileView.as_view(), name='profile'), url(r'^edit/$', ProfileEdit.as_view(), name='profile-edit'), ) if getattr(settings, 'REGISTRATION_ENABLED', False): urlpatterns += patterns('', url(r'^register/$', RegisterView.as_view(), name='profile-register'), )
from django.conf.urls import url from profiles.views import ProfileView,profile_edit, accept_terms app_name = 'profiles' urlpatterns = [ # ex: .com/profile/view/21/ url(r'^view/(?P<pk>[\d]+)/$', ProfileView.as_view(), name='profiles_view_profile'), # ex: .com/profile/edit url(r'^edit/$', profile_edit, name='profiles_edit'), # ex: .com/profile/terms/ url(r'^terms/$', accept_terms, name='profiles_terms'), ]
from django.conf.urls import patterns, include, url from django.contrib import admin from profiles.views import AccountRegistration, ProfileView, SearchView admin.autodiscover() urlpatterns = patterns('', url(r'^$', ProfileView.as_view(), name='root_page'), url(r'^profile/$', ProfileView.as_view(), name='profile_page'), url(r'^search/$', SearchView.as_view()), #registration (r'^register/$', AccountRegistration.as_view()), url(r'^login/$', 'django.contrib.auth.views.login', {'template_name':'profiles/login.haml'}, name='login'), url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'), url(r'^password/reset/$', 'django.contrib.auth.views.password_reset', {'template_name': 'profiles/password_reset_form.haml'}), url(r'^password/reset/done/$', 'django.contrib.auth.views.password_reset_complete', {'template_name': 'profiles/password_reset_complete.haml'}), url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name': 'profiles/password_reset_confirm.haml'}, name='password_reset_confirm'), url(r'^password/reset/complete/$', 'django.contrib.auth.views.password_reset_done', {'template_name': 'profiles/password_reset_done.haml'}), )
from django.urls import path from profiles.views import ProfileView app_name = 'profile' urlpatterns = [ path('', ProfileView.as_view(), name='home'), ]
Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.contrib import admin from content.views import BlogListView from profiles.views import RegisterCreateView, activate_user_view, ProfileView, ProfileFollowToggle from django.contrib.auth.views import LoginView, LogoutView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', BlogListView.as_view(), name='home'), url(r'^content/', include('content.urls', namespace='content')), url(r'^profile/$', ProfileView.as_view(), name='profile-view'), url(r'^register/$', RegisterCreateView.as_view(), name='register'), url(r'^activate/(?P<code>[a-z0-9].*)/$', activate_user_view, name='activate'), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^profile-follow/$', ProfileFollowToggle.as_view(), name='follow'), url(r'^', include('profiles.urls', namespace='profile')), ]
from django.conf.urls import patterns, url from profiles.views import ProfileView, ProfileUpdateView urlpatterns = patterns('', url(r"^(?P<slug>[\w.@+-]+)/$", ProfileView.as_view(), name="detail"), url(r"^$", ProfileUpdateView.as_view(), name="edit"), )
def when_get_is_called(self, logged_person_id, username): self.body, self.status = ProfileView(get_profile_interactor=self.interactor) \ .get(logged_person_id=logged_person_id, username=username) return self
def when_patch_is_called(self, logged_person_id, bio): self.body, self.status = ProfileView(modify_profile_interactor=self.interactor) \ .patch(logged_person_id=logged_person_id, bio=bio) return self
from django.conf.urls import url from django.conf import settings from django.conf.urls.static import static # from django.urls import reverse_lazy from profiles.views import ( MyProfile, LoginView, LogoutView, ProfileListView, ProfileView, ShowInterest ) urlpatterns = [ url(r'^$', LoginView.as_view()), url(r'^admin/', admin.site.urls), url(r'^profiles/me/$', MyProfile.as_view()), url(r'^profiles/(?P<id>\d+)/$', ProfileView.as_view()), url(r'^profiles/$', ProfileListView.as_view()), url(r'^profiles/(?P<id>\d+)/show-interest$', ShowInterest.as_view()), url(r'^login/$', LoginView.as_view()), url(r'^logout/$', LogoutView.as_view()), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.views.generic import RedirectView from rest_framework.routers import DefaultRouter from checkout.views import CheckoutView from contact.views import ContactView from profiles.views import ProfileView ROUTER = DefaultRouter() urlpatterns = [ path('api/', include(ROUTER.urls)), path('', RedirectView.as_view(pattern_name='goods:list'), name='home'), path('admin/', admin.site.urls), path('goods/', include('goods.urls', namespace='goods')), path('categories/', include('categories.urls', namespace='categories')), path('profile/', ProfileView.as_view(), name='profile'), path('checkout/', CheckoutView.as_view(), name='checkout'), path('contact/', ContactView.as_view(), name='contact'), path('accounts/', include('allauth.urls')), path('taggit/', include('taggit_selectize.urls')), path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # TODO: Implement 2FA & update corresponding Cover letter # TODO: Implement TBA using django-allauth & update corresponding Cover letter
from django.conf.urls.defaults import patterns, include, url from profiles.views import ProfileView urlpatterns = patterns('', url(r'^$', ProfileView.as_view(), name='profiles_list'), url(r'^login/$', 'profiles.views.login', name='profiles_login'), )
from django.conf.urls import url from profiles.views import ProfileView urlpatterns = [url(r'^policy/$', ProfileView.as_view())]