def test_url_router_path(): """ Tests that URLRouter also works with path() """ from django.urls import path kwarg_app = MagicMock(return_value=3) router = URLRouter( [ path("", MagicMock(return_value=1)), path("foo/", MagicMock(return_value=2)), path("author/<name>/", kwarg_app), path("year/<int:year>/", kwarg_app), ] ) # Valid basic matches assert router({"type": "http", "path": "/"}) == 1 assert router({"type": "http", "path": "/foo/"}) == 2 # Named without typecasting assert router({"type": "http", "path": "/author/andrewgodwin/"}) == 3 assert kwarg_app.call_args[0][0]["url_route"] == { "args": tuple(), "kwargs": {"name": "andrewgodwin"}, } # Named with typecasting assert router({"type": "http", "path": "/year/2012/"}) == 3 assert kwarg_app.call_args[0][0]["url_route"] == { "args": tuple(), "kwargs": {"year": 2012}, } # Invalid matches with pytest.raises(ValueError): router({"type": "http", "path": "/nonexistent/"})
def test_url_router_nesting_path(): """ Tests that nested URLRouters add their keyword captures together when used with path(). """ from django.urls import path test_app = MagicMock(return_value=1) inner_router = URLRouter([ path("test/<int:page>/", test_app), ]) def asgi_middleware(inner): # Some middleware which hides the fact that we have an inner URLRouter def app(scope): return inner(scope) app._path_routing = True return app outer_router = URLRouter([ path("number/<int:number>/", asgi_middleware(inner_router)), ]) assert inner_router({"type": "http", "path": "/test/3/"}) == 1 assert outer_router({"type": "http", "path": "/number/42/test/3/"}) == 1 assert test_app.call_args[0][0]["url_route"] == { "args": (), "kwargs": {"number": 42, "page": 3}, } with pytest.raises(ValueError): assert outer_router({"type": "http", "path": "/number/42/test/3/bla/"}) with pytest.raises(ValueError): assert outer_router({"type": "http", "path": "/number/42/blub/"})
def get_urls(self): urls = super(ITSystemAdmin, self).get_urls() urls = [ path('export/', self.admin_site.admin_view(ITSystemExport.as_view()), name='itsystem_export'), path('discrepancies/', self.admin_site.admin_view(ITSystemDiscrepancyReport.as_view()), name='itsystem_discrepancies'), ] + urls return urls
def test_non_identifier_parameter_name_causes_exception(self): msg = ( "URL route 'hello/<int:1>/' uses parameter name '1' which isn't " "a valid Python identifier." ) with self.assertRaisesMessage(ImproperlyConfigured, msg): path(r'hello/<int:1>/', lambda r: None)
def get_urls(self, prefix=True): """ Return urlpatterns to add for this model's BREAD interface. By default, these will be of the form: Operation Name URL --------- -------------------- -------------------------- Browse browse_<plural_name> <plural_name>/ Read read_<name> <plural_name>/<pk>/ Edit edit_<name> <plural_name>/<pk>/edit/ Add add_<name> <plural_name>/add/ Delete delete_<name> <plural_name>/<pk>/delete/ Example usage: urlpatterns += my_bread.get_urls() If a restricted set of views is passed in the 'views' parameter, then only URLs for those views will be included. If prefix is False, ``<plural_name>/`` will not be included on the front of the URLs. """ prefix = '%s/' % self.plural_name if prefix else '' urlpatterns = [] if 'B' in self.views: urlpatterns.append( path('%s' % prefix, self.get_browse_view(), name=self.browse_url_name(include_namespace=False))) if 'R' in self.views: urlpatterns.append( path('%s<int:pk>/' % prefix, self.get_read_view(), name=self.read_url_name(include_namespace=False))) if 'E' in self.views: urlpatterns.append( path('%s<int:pk>/edit/' % prefix, self.get_edit_view(), name=self.edit_url_name(include_namespace=False))) if 'A' in self.views: urlpatterns.append( path('%sadd/' % prefix, self.get_add_view(), name=self.add_url_name(include_namespace=False))) if 'D' in self.views: urlpatterns.append( path('%s<int:pk>/delete/' % prefix, self.get_delete_view(), name=self.delete_url_name(include_namespace=False))) return urlpatterns
def get_urls(self): urls = super(DepartmentUserAdmin, self).get_urls() urls = [ path('alesco-import/', self.admin_site.admin_view(self.alesco_import), name='alesco_import'), path('export/', DepartmentUserExport.as_view(), name='departmentuser_export'), #path('export/', self.admin_site.admin_view(self.export), name='departmentuser_export'), ] + urls return urls
def get_urls(self): urls = super().get_urls() my_urls = [ path('immortal/', self.set_immortal), path('mortal/', self.set_mortal), path('import-csv/', self.import_csv), ] return my_urls + urls
def urls(self, name_prefix=None): """Override the DjangoResource ``urls`` class method so the detail view accepts a GUID parameter instead of PK. """ return [ path('', self.as_list(), name=self.build_url_name('list', name_prefix)), path('fast/', self.as_view('list_fast'), name=self.build_url_name('list_fast', name_prefix)), re_path(r'^(?P<guid>[0-9A-Za-z-_@\'&\.]+)/$', self.as_detail(), name=self.build_url_name('detail', name_prefix)), ]
def make_urls(url_fragment, list_view, detail_view, namespace): """Register list and detail view for each type of content.""" return path(url_fragment, include(( [path('', list_view.as_view(), name='list'), path('<slug:slug>/', detail_view.as_view(), name='detail')], 'consulting'), namespace=namespace))
def get_urls(self): urls = super(HardwareAssetAdmin, self).get_urls() extra_urls = [ path( 'import/', self.admin_site.admin_view(self.asset_import), name='asset_import'), path( 'import/confirm/', self.admin_site.admin_view(self.asset_import_confirm), name='asset_import_confirm'), # path('export/', self.hardwareasset_export, name='hardwareasset_export'), path('export/', HardwareAssetExport. as_view(), name='hardwareasset_export'), ] return extra_urls + urls
def get_urlpatterns(self): """ Returns the URL patterns managed by the considered factory / application. """ return [ path(_('topics/'), self.latest_topics_feed(), name='latest_topics'), path( _('forum/<str:forum_slug>-<int:forum_pk>/topics/'), self.latest_topics_feed(), name='forum_latest_topics', ), path( _('forum/<str:forum_slug>-<int:forum_pk>/topics/all/'), self.latest_topics_feed(), {'descendants': True}, name='forum_latest_topics_with_descendants', ), ]
def get_urls(self): return [ path( '<id>/password/', self.admin_site.admin_view(self.user_change_password), name='auth_user_password_change', ), ] + super().get_urls()
def additional_urls(self): from django.urls import path urls = [] if self.is_admin: from django.contrib import admin urls.append(path("ssb/", admin.site.urls)) return urls
def get_urlpatterns(self): """ Returns the URL patterns managed by the considered factory / application. """ return [ path( '', search_view_factory(view_class=self.search_view, form_class=self.search_form), name='search', ), ]
def get_urls(self): urls = super().get_urls() extra_urls = [ path( 'maintenance/', self.admin_site.admin_view(self.maintenance_view) ) ] urls = extra_urls + urls return urls
def test_messaging_for_non_regex_patterns(self): if django.VERSION < (2, 0): self.skipTest('only works on django 2.0 or newer') from django.urls import path with mocked_patterns([ path('tested-url/', WorkingView.as_view()), path('untested-url/', WorkingView.as_view()), url(r'^another-untested-url/$', WorkingView.as_view()), ]): results = get_results_for('test_all_urls_accounted_for', covered_urls=['/tested-url/']) self.assertEqual( 'The following views are untested:\n\n' '() untested-url/ (None)\n' '() ^another-untested-url/$ (None)\n\n{}' .format(IGNORE_TUTORIAL.format(name='EverythingTest')), results.failures[0][1][1].args[0], )
def get_urlpatterns(self): """ Returns the URL patterns managed by the considered factory / application. """ return [ path( _('profile/edit/'), self.forum_profile_update_view.as_view(), name='profile_update', ), path( _('profile/<str:pk>/'), self.forum_profile_detail_view.as_view(), name='profile', ), path( _('profile/<str:pk>/posts/'), self.user_posts_list.as_view(), name='user_posts', ), path( _('subscriptions/'), self.topic_subscription_list_view.as_view(), name='user_subscriptions', ), path( _('topic/<int:pk>/subscribe/'), self.topic_subscribe_view.as_view(), name='topic_subscribe', ), path( _('topic/<int:pk>/unsubscribe/'), self.topic_unsubscribe_view.as_view(), name='topic_unsubscribe', ), ]
def get_urls(self): from django.urls import include, path, re_path # Since this module gets imported in the application's root package, # it cannot import models from other applications at the module level, # and django.contrib.contenttypes.views imports ContentType. from django.contrib.contenttypes import views as contenttype_views def wrap(view, cacheable=False): def wrapper(*args, **kwargs): return self.admin_view(view, cacheable)(*args, **kwargs) wrapper.admin_site = self return update_wrapper(wrapper, view) # Admin-site-wide views. urlpatterns = [ path('', wrap(self.index), name='index'), path('login/', self.login, name='login'), path('logout/', wrap(self.logout), name='logout'), path('password_change/', wrap(self.password_change, cacheable=True), name='password_change'), path( 'password_change/done/', wrap(self.password_change_done, cacheable=True), name='password_change_done', ), path('jsi18n/', wrap(self.i18n_javascript, cacheable=True), name='jsi18n'), path( 'r/<int:content_type_id>/<path:object_id>/', wrap(contenttype_views.shortcut), name='view_on_site', ), ] # Add in each model's views, and create a list of valid URLS for the # app_index valid_app_labels = [] for model, model_admin in self._registry.items(): urlpatterns += [ path('%s/%s/' % (model._meta.app_label, model._meta.model_name), include(model_admin.urls)), ] if model._meta.app_label not in valid_app_labels: valid_app_labels.append(model._meta.app_label) # If there were ModelAdmins registered, we should have a list of app # labels for which we need to allow access to the app_index view, if valid_app_labels: regex = r'^(?P<app_label>' + '|'.join(valid_app_labels) + ')/$' urlpatterns += [ re_path(regex, wrap(self.app_index), name='app_list'), ] return urlpatterns
def path(self, view): """ Return a django path from this route information. Extra view kwarg 'route' will be set to Route.func. :param function view: view function to use with the route :return django url path """ kw = self.kwargs.copy() kw['route'] = self.func return urls.path( self.pattern, view, name = self.name, kwargs = kw )
def make_urlpatterns(): patterns = [] for key in config_value("PAYMENT", "MODULES"): try: cfg = config_get(key, "MODULE") except SettingNotSet: log.warning("Could not find module %s, skipping", key) continue module_name = cfg.editor_value url_module = "%s.urls" % module_name namespace = module_name.split(".")[-1] patterns.append( path(config_value(key, "URL_BASE"), [url_module, module_name, namespace]) ) return patterns
def get_urlpatterns(self): """ Returns the URL patterns managed by the considered factory / application. """ return [ path( _('mark/forums/'), self.mark_forums_read_view.as_view(), name='mark_all_forums_read', ), path( _('mark/forums/<int:pk>/'), self.mark_forums_read_view.as_view(), name='mark_subforums_read', ), path( _('mark/forum/<int:pk>/topics/'), self.mark_topics_read_view.as_view(), name='mark_topics_read', ), path( _('unread-topics/'), self.unread_topics_view.as_view(), name='unread_topics', ), ]
def get_urls(self): from django.urls import path def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view)(*args, **kwargs) wrapper.model_admin = self return update_wrapper(wrapper, view) model_info = self._get_model_info() return [ path('<path:object_id>/move-<direction>/', wrap(self.move_view), name='{app}_{model}_change_order'.format(**model_info)), ] + super(OrderedModelAdmin, self).get_urls()
def urlconf(): if django.VERSION < (1, 9): included_url_conf = ( url(r'^foo/bar/(?P<param>[\w]+)', lambda x: ''), ), '', '' else: included_url_conf = (( url(r'^foo/bar/(?P<param>[\w]+)', lambda x: ''), ), '') if django.VERSION >= (2, 0): from django.urls import path, re_path example_url_conf = ( re_path(r'^api/(?P<project_id>[\w_-]+)/store/$', lambda x: ''), re_path(r'^report/', lambda x: ''), re_path(r'^example/', include(included_url_conf)), path('api/v2/<int:project_id>/store/', lambda x: '') ) return example_url_conf
def urlpatterns(cl): """ Return url patterns as a list. It ensures routes are generated before it returns anything. """ if not cl._urlpatterns: routes = ( attr._route for attr in [ getattr(cl, k) for k in dir(cl) # avoid recursion if k != 'urlpatterns' ] if callable(attr) and hasattr(attr, '_route') and \ isinstance(attr._route, Route) ) cl._urlpatterns = [ urls.path( route.pattern, cl.as_view(route = route, **route.kwargs), name = route.name, ) for route in sorted(routes, key=lambda r: r.pattern) ] return cl._urlpatterns
"""mom_helper_project URL Configuration 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.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), ]
"""backend URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.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.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('api.urls')), path('spotify/', include('spotify.urls')) ]
from django.urls import path from . import views app_name = 'projects' urlpatterns = [ path('', views.ProjectsView.as_view(), name="projects"), path('create/', views.CreateProject.as_view(), name="create_project"), path('<int:pk>/', views.ProjectDetail.as_view(), name="project"), path('<int:pk>/update', views.UpdateProject.as_view(), name="update_project"), path('<int:pk>/delete', views.DeleteProject.as_view(), name="delete_project"), ]
"""Defines URL patterns for the main body of the app""" from django.urls import path, include from . import views app_name = 'main' urlpatterns = [ #Include default auth urls path('', include('django.contrib.auth.urls')), #Home page path('', views.index, name='index'), #Registration page path('register/', views.register, name='register'), ]
from django.urls import path from . import views app_name = 'catalog_app' urlpatterns = [ path('', views.index, name='index'), path('books/', views.book_list, name='books'), path('magazines/', views.magazine_list, name='magazines'), path('check_out_book/', views.check_out_book, name='check_out_book'), path('check_out_magazine/', views.check_out_magazine, name='check_out_magazine'), path('return/', views.return_article, name='return'), path('past_due/', views.past_due, name='past_due'), path('my_books/', views.my_books, name='my_books'), ]
from django.contrib import admin from django.urls import path from employee import views urlpatterns = [ path('admin/', admin.site.urls), path('emp', views.emp), path('show',views.show), path('edit/<int:id>', views.edit), path('update/<int:id>', views.update), path('delete/<int:id>', views.destroy), ]
from django.urls import path from compare import views app_name = 'cars' urlpatterns = [path('', views.home, name='cars')]
# url(r'^dtable_test.php$', mainview.dtable_test), # url(r'^searching_test.php$', mainview.searching_test), # url(r'^sorting_test.php$', mainview.sorting_test), # url(r'^paging_test.php$', mainview.paging_test), # url(r'^feeder.php$', mainview.feeder), # url(r'^receiver.php$', mainview.receiver), # url(r'^combo_test.php$', mainview.combo_test), # url(r'^combo_test2.php$', mainview.combo_test2), # url(r'^combo_test3.php$', mainview.combo_test3), # url(r'^fetch_brands.php$', mainview.fetch_brands), # url(r'^fetch_products.php$', mainview.fetch_products), # url(r'^search.php$', mainview.search), # url(r'^welcome$', mainview.welcome), # url(r'^extjs/',include('extjs.urls')), url(r'^rest/',include('rest.urls')), # url(r'^fs/',include('fs.urls')), # url(r'^parts/',include('mysite.parts.urls')), # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: #url(r'^admin/lookups/', include(ajax_select_urls)), path('admin/', admin.site.urls), #url(r'^explore/',include('explore.urls')), url(r'^accounts/login/$', mainview.loginpage), url(r'^sql/$', mainview.sql), # url(r'^login/',mainview.mylogin), # url(r'^logout/',mainview.mylogout), # url(r'^afterlogin/',mainview.afterlogin), ] urlpatterns += staticfiles_urlpatterns() urlpatterns +=static(settings.MEDIA_URL,django.contrib.staticfiles.views.serve)
"""comocomo URL Configuration 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.contrib import admin from django.urls import include, path, re_path from rest_framework import routers from gathering import views as gathering_views from barns import views as barns_views urlpatterns = [ path('admin/', admin.site.urls), path('api/v1/', include('rest_auth.urls')), path('api/v1/food-kinds/', gathering_views.FoodKindViewSet.as_view({'get': 'list'}), name='food-kinds'), path('api/v1/food-kinds/<kind_id>/food-types/', gathering_views.FoodTypeViewSet.as_view({'get': 'list'}), name='food-types'), path('api/v1/food-registrations/', gathering_views.FoodRegistrationView.as_view(), name='food-registrations'), path('api/v1/week-statistics/<from_date>/<to_date>/', barns_views.WeekStatisticsView.as_view(), name='week-statistics'), ]
from django.contrib.auth import views as auth_views from django.urls import path from django.views.generic import TemplateView from . import forms from . import views app_name = "qs_accounts" urlpatterns = [ # Auth path("signin/", views.LoginView.as_view(), name="signin"), path("signout/", views.LogoutView.as_view(), name="signout"), # Password reset path("password/reset/", views.PasswordResetView.as_view(), name="password_reset"), path("password/reset/<reset_token>/", views.PasswordResetConfirmView.as_view(), name="password_reset_confirm"), # Basic Registration path("signup/", view=views.SignupView.as_view(), name="signup"), path('signup/complete/', view=TemplateView.as_view(template_name='accounts/signup-complete.html', ), name='signup_complete'), path('activate/<activation_key>/', view=views.SignupActivationView.as_view(), name='activate'), path('signup/closed/', TemplateView.as_view(template_name='accounts/signup-closed.html'), name='signup_closed'), # Profile path("profile/", view=views.UserProfileView.as_view(), name="profile"), path("profile/password/", views.PasswordChangeView.as_view(), name="password_change"), path("profile/email/", views.EmailChangeView.as_view(), name="email_change"),
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/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.contrib import admin from django.urls import path,include from django.conf.urls.static import static from django.conf import settings from products.views import product_search,product_search_auto urlpatterns = [ path('admin/', admin.site.urls), path('', include('accounts.urls')), path('', include('page.urls')), path('blog/', include('blog.urls')), path('products/', include('products.urls')), path('orders/', include('orders.urls')), # ÃœRÃœN ARAMA URL path('search/', product_search, name="product_search"), path('search_auto/', product_search_auto, name="product_search_auto"), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""dbmspr URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/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.contrib import admin from django.urls import path,include urlpatterns = [ path('',include('homepage.urls')), path('admin/', admin.site.urls), ]
"""PhotographyPage URL Configuration 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.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path(r'', include('web.urls')), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.urls import path from . import views from lgc import views as lgc_views urlpatterns = [ path('expirations/', views.hr_expirations, name='hr-expirations'), path('employees/', views.HRPersonListView.as_view(), name='hr-employees'), path('file/<int:pk>', views.PersonUpdateView.as_view(), name='hr-employee-file'), path('initiate-case/', views.initiate_case, name='hr-initiate-case'), path('download/<int:pk>/', lgc_views.download_file, name='hr-download-file'), ]
"""StudentMailBenifits URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.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.contrib import admin from django.urls import path, include from .home_view import home_view urlpatterns = [ path('admin/', admin.site.urls), path("api/", include("benefits.api_urls")), path("benefits/", include("benefits.web_urls")), path("users/", include("users.urls")), path("", home_view) ]
from django.urls import path from . import views app_name = 'article' urlpatterns = [ path('list/', views.article_list, name='article_list'), path('<int:article_id>/', views.article_detail, name='article_detail'), ]
from django.urls import path from . import views urlpatterns =[ path('',views.home,name="home"), path('home/',views.home,name="home"), path('employee/',views.employee,name="employee-home"), path('broker/',views.broker,name ="broker-home"), path('about/',views.about,name="about"), path('contact/',views.contact,name="contact"), path('employee_update/<int:id>/',views.employee_update,name="employee-update"), path('employee_delete/<int:id>/',views.employee_delete,name="employee-delete"), ]
from django.urls import path from .views import CartView, PaymentView urlpatterns = [ path('/cart', CartView.as_view()), path('/payment', PaymentView.as_view()) ]
from django.contrib import admin from django.urls import path from django.urls import include from django.views.generic import RedirectView from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('infirmary/', include('infirmary.urls')), path('accounts/', include('django.contrib.auth.urls')), path('favicon.ico', RedirectView.as_view(url='/static/img/favicon.ico', permanent=True)), path('',RedirectView.as_view(url='/infirmary/', permanent=True)), ]
from django.conf import settings from django.contrib import admin from django.urls import include, path from django.views.generic import TemplateView from apps.accounts.urls import accounts_router from apps.base.views import NameChange, http_404, http_500 urlpatterns: List[path] = [] # Debug/Development URLs if settings.DEBUG is True: import debug_toolbar urlpatterns += [ path("__debug__/", include(debug_toolbar.urls)), path("admin/doc/", include("django.contrib.admindocs.urls")), ] # Includes urlpatterns += [path(r"admin/", admin.site.urls)] # Project Urls urlpatterns += [ path("", TemplateView.as_view(template_name="index.html"), name="site_index"), path("api-auth/", include("rest_framework.urls")), path("api/accounts/", include(accounts_router.urls)), path("500/", http_500), path("404/", http_404),
"""projectteste URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/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.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('blog.urls')), ]
from django.urls import path from django.contrib.auth.views import LoginView from . import views urlpatterns = [ path('', views.home, name='home'), path('login/', LoginView.as_view(), name='entrar'), path('logout/', views.meu_logout, name='sair'), path('relatorio/', views.meu_logout, name='download_relatorio'), path('teste/', views.teste, name='teste'), path('viagem/nova', views.nova_viagem, name='nova_viagem'), path('viagem/atualizar/<int:id>', views.atualizar_viagem, name='atualizar_viagem'), path('viagem/apagar/<int:id>', views.apagar_viagem, name='apagar_viagem'), path('motorista/novo', views.novo_motorista, name='novo_motorista'), path('motorista/atualizar/<int:id>', views.atualizar_motorista, name='atualizar_motorista'), path('motorista/apagar/<int:id>', views.apagar_motorista, name='apagar_motorista'), path('veiculo/novo', views.novo_veiculo, name='novo_veiculo'), path('veiculo/atualizar/<int:id>', views.atualizar_veiculo, name='atualizar_veiculo'), path('veiculo/apagar/<int:id>', views.apagar_veiculo, name='apagar_veiculo'), ]
from django.contrib import admin from django.urls import path,include from django.conf.urls.static urlpatterns = [ path('admin/', admin.site.urls), path('', include('index.urls')), path('student/',include('student.urls')), ]
from django.urls import path from . import views urlpatterns = [ path("", views.index, name="index"), path("login", views.login_view, name="login"), path("logout", views.logout_view, name="logout"), path("register", views.register, name="register"), path('categories', views.categories, name="categories"), path('categories/<str:this_category>', views.specific_category, name="category"), path('watchlist', views.watchlist, name="watchlist"), path('new', views.new_listing, name="new_listing"), path('listing/<int:id>', views.listing, name="listing"), path('listing/<int:id>/watchlist_toggle', views.watchlist_toggle, name="watchlist_toggle"), path('listing/<int:id>/close_bidding', views.close_bidding, name='close_bidding') ]
from django.urls import path from profile import views #app_name = 'profile' urlpatterns = [ path('<str:username>/', views.profile, name='profile'), path('<str:username>/following', views.following, name='following'), path('<str:username>/followers', views.followers, name='followers'), path('<str:username>/follow', views.follow, name='follow'), path('<str:username>/stopfollow', views.stopfollow, name='stopfollow'), path('signout/', views.signout, name='signout'), ]
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from django.conf.urls.static import static from django.conf import settings from django.contrib.sitemaps import GenericSitemap # new from django.contrib.sitemaps.views import sitemap # new from base.models import * # new info_dict = { 'queryset': LatestPost.objects.all(), } urlpatterns = [ path('admin/', admin.site.urls), path('', include('base.urls')), # path('summernote/', include('django_summernote.urls')), path( 'sitemap.xml', sitemap, # new {'sitemaps': { 'blog': GenericSitemap(info_dict, priority=0.6) }}, name='django.contrib.sitemaps.views.sitemap'), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from . import views urlpatterns = [ path(' ',views.cart,name='cart'), path('<int:product_id>',views.add_to_cart,name='add-to-cart'), path('remove_from_cart/<int:product_id>',views.remove_from_cart,name='remove-from-cart'), path('remove_singal_item_from_cart/<int:product_id>',views.remove_singal_item_from_cart,name='remove-singal-item-from-cart'), path('checkout',views.checkout,name='checkout'), path('payment',views.payment,name='payment'), ]
from django.urls import path, include from . import views from django.conf import settings from django.conf.urls.static import static from rest_framework import routers, serializers, viewsets from .views import UserViewSet, UserSerializer, CursoSerializer, CursosViewSet router = routers.DefaultRouter() router.register('users', UserViewSet) router.register('cursos', CursosViewSet) urlpatterns = [ # api rest path('API', include(router.urls)), path('api-auth/', include('rest_framework.urls'), name="rest_framework"), path('', views.index, name='index'), #path('index', views.index, name='index'), path('testimonios', views.testimonios), path('suscripcion', views.suscripcion), #----- usuario ----- path('agregarUsuario', views.RegistroUsuario.as_view()), #create path('borrarUsuario/<int:usuarioId>', views.borrarUsuario), #delete path('editarUsuario/<int:usuarioId>', views.editarUsuario), #edit path('listarUsuariosFull', views.listarUsuarioFull, name="listarUsuariosFull"), #readFull path('listarUsuarios', views.listarUsuarios, name='listarUsuarios'), #read # ----- Curso ---- path('agregarCurso', views.CreateCurso.as_view()), #create path('borrarCurso/<int:cursoId>', views.borrarCurso), #delete
from django.contrib import admin from django.urls import path from scraping.views import home_view urlpatterns = [path('admin/', admin.site.urls), path('home/', home_view)]
from django.urls import path,include from .views import home,convert urlpatterns = [ path('', home), path('convert',convert) ]
from django.contrib import admin from django.urls import include, path from django.views.generic.base import RedirectView urlpatterns = [ path("", RedirectView.as_view(url="/pages/ahernp-com"), name="homepage"), path("admin/", admin.site.urls), path("api/v1/", include("api.v1.urls")), path("blog/", include("blog.urls")), path("dashboard/", include("dashboard.urls")), path("feedreader/", include("feedreader.urls")), path("pages/", include("mpages.urls")), path("core/", include("core.urls")), path("timers/", include("timers.urls")), path("tools/", include("tools.urls")), ]
from django.urls import path from .views import home, client_info urlpatterns = [ path('', home), path('client/<int:client_id>', client_info) ]
from django.urls import path from . import views app_name = 'main' urlpatterns = [ path('', views.index, name='index'), path('worker/<str:pod_name>/', views.worker, name='worker'), path('runs/<int:run_id>/', views.run, name='run'), path('runs', views.runs, name='runs') ]
from django.urls import path, include from .views import (AlbumListView, AlbumDetailView, ContentView, ContentTypeView, VisibilityListView, PostContent) urlpatterns = [ path('album_list/', AlbumListView.as_view(), name="album_list"), path('album/<pk>', AlbumDetailView.as_view(), name="album_detail"), path('content/<pk>', ContentView.as_view(), name="content"), path('visibility/', VisibilityListView.as_view(), name="content"), path('content-type/', ContentTypeView.as_view(), name='content-type'), path('post_list/', PostContent.as_view(), name='post-content') ]
from django.urls import path from mftutor.tutor.auth import tutorbest_required from .views import OwnConfirmationView, ConfirmationTableView, EditNoteView, ConfirmationCardView, ReminderEmailView urlpatterns = [ path('', OwnConfirmationView.as_view(), name='own_confirmation'), path('table/', tutorbest_required(ConfirmationTableView.as_view()), name='confirmation_table'), path('card/', tutorbest_required(ConfirmationCardView.as_view()), name='confirmation_card'), path('editnote/', EditNoteView.as_view(), name='confirmation_edit_note'), path('reminder/', tutorbest_required(ReminderEmailView.as_view()), name="confirmation_reminder"), ]
from django.urls import path from .views import ListItemView urlpatterns = [ path('items/', ListItemView.as_view()) ]