def _register_defaults(self): """ Registers some meta data about the Extension developers and gives the '/api' route a nice index of all registered blueprints. """ self.app.add_url_rule("%s/" % MongoAPI.API_PREFIX, view_func=HomeView.as_view('home_page', app=self.app)) self.app.add_url_rule("%s/" % MongoAPI.ABOUT, view_func=AboutView.as_view('about_page', app=self.app))
class AboutController(BaseController): def __init__(self, router, payload): super().__init__(router, payload) self.__view = AboutView(self) self.__view.render(payload) ''' Handle the user's choice and redirect them to the appropriate view. @param choice {int} Number corresponding to the view in the ordered list menu. @param meta {Any} The meta value associated with the choice. ''' def on_choice_selection(self, choice, meta): if choice == 1: self.go_back()
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: 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 from django.contrib import admin from django.views.generic import TemplateView from views import AboutView, BookListView, MyView, PublisherList, PublisherBookList, AuthorDetailView from django.contrib.auth.decorators import login_required urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^about/', AboutView.as_view()), url(r'^demo/$', BookListView.as_view()), url(r'^myview/$', MyView.as_view()), url(r'^publishers/$', PublisherList.as_view()), url(r'^books/([\w-]+)/$', PublisherBookList.as_view()), url(r'^authors/(?P<pk>[0-9]+)/$', AuthorDetailView.as_view(), name='author-detail'), ]
(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """ urlpatterns = patterns( '', url(r'^$', HomeView.as_view(), name='home'), url(r'^about$', AboutView.as_view(), name='about'), url(r'^legal$', LegalView.as_view(), name='legal'), url(r'^search$', SearchView.as_view(), name='search'), url(r'^js/search.js$', search_script, name='search.js'), # Categories url(r'^categories/$', CategoryListView.as_view(), name='categories'), url(r'^categories/add$', CategoryAddView.as_view(), name='add-category'), url(r'^categories/(?P<name>[\w_-]+)-(?P<pk>\d+)/', include(patterns( '', url(r'^view$', CategoryDetailView.as_view(), name='view-category'), url(r'^edit$', CategoryEditView.as_view(), name='edit-category'), url(r'^delete$', CategoryDeleteView.as_view(), name='delete-category'), ))),
url(r'^palestras/$', TalkListView.as_view(), name='talks'), url(r'^$', IndexView.as_view(), name='index'), url(r'^palestras/(?P<pk>\d+)/$', TalkDetailView.as_view(), name='talk'), url(r'^palestras/(?P<talk_id>\d+)/assistir/$', "choice_talk", name="choice_talk"), url(r"^gerar_grade/", 'gerar_grade', name="gerar_grade"), url(r'^palestrantes/(?P<pk>\d+)/$', AuthorDetailView.as_view(), name='author'), url(r'^trilhas/$', ListView.as_view( model=Zone, context_object_name="zone_list")), url(r'^trilhas/(?P<pk>\d+)/$', ZoneDetailView.as_view(), name='zone'), url(r'^salas/$', ListView.as_view( model=Room, context_object_name="rooms")), url(r'^salas/(?P<pk>\d+)/$', RoomDetailView.as_view(), name='room'), url(r'^dia/(\w+)/$', DayTalkListView.as_view()), url(r'^dia/$', ListView.as_view( queryset=Talk.objects.dates("date", "day"), template_name="grade/days_list.html", context_object_name="days")), url(r'^agora/$', NowListView.as_view(), name='now'), url(r'^sobre/$', AboutView.as_view(), name='about'), url(r'^busca/$', SearchTalkListView.as_view()), url(r'^code/$', RedirectView.as_view(url='https://github.com/willemarcel/gradefisl'), name='code'), )
def __init__(self, router, payload): super().__init__(router, payload) self.__view = AboutView(self) self.__view.render(payload)
from flask import Blueprint from views import IndexView, AboutView from views import BooksView, AuthorsView from views import BookView, AuthorView from views import BookAPI, AuthorAPI from views import RunTests, Search from views import CocktailIngredients blueprint = Blueprint('idb', __name__, template_folder='templates') blueprint.add_url_rule('/', view_func=IndexView.as_view('Home')) blueprint.add_url_rule('/about', view_func=AboutView.as_view('About')) blueprint.add_url_rule('/books', view_func=BooksView.as_view('Books')) blueprint.add_url_rule('/authors', view_func=AuthorsView.as_view('Authors')) blueprint.add_url_rule( '/author/<author_id>', view_func=AuthorView.as_view('Author')) blueprint.add_url_rule('/book/<book_id>', view_func=BookView.as_view('Book')) blueprint.add_url_rule( '/api/books/', defaults={'book_id': None}, view_func=BookAPI.as_view('BooksAPI')) blueprint.add_url_rule( '/api/books/<book_id>', view_func=BookAPI.as_view('BookAPI')) blueprint.add_url_rule( '/api/authors/', defaults={'author_id': None}, view_func=AuthorAPI.as_view('AuthorsAPI')) blueprint.add_url_rule( '/api/authors/<author_id>', view_func=AuthorAPI.as_view('AuthorAPI')) blueprint.add_url_rule('/tests', view_func=RunTests.as_view('RunTests')) blueprint.add_url_rule( '/search/<search_string>', view_func=Search.as_view('Search'))
Examples: 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 django.conf.urls.static import static from django.conf import settings from views import AboutView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', AboutView.as_view(), name='index'), url(r'^python/', include('python.urls'), name = 'python'), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.STATIC_ROOT) import debug_toolbar urlpatterns = [ url(r'^__debug__/', include(debug_toolbar.urls)), ] + urlpatterns
path('me/', UserSettingsView.as_view(), name='user_settings'), path('me/signup/', UserSignupView.as_view(), name='user_signup'), path('me/signin/', UserSigninView.as_view(), name='user_signin'), path('me/signout/', UserSignoutView.as_view(), name='user_signout'), path('me/username/', UsernameChangeView.as_view(), name='user_change_username'), path('me/avatar/', include('avatar.urls')), path('me/', include('allauth.urls')), # Staff admin path('admin/', admin.site.urls), # Home page path('', HomeView.as_view(), name='home'), # About pages etc path('about/', AboutView.as_view(), name='about'), path('about/contact/', ContactView.as_view(), name='contact'), path('about/help/', HelpView.as_view(), name='help'), path('about/privacy-policy/', PrivacyView.as_view(), name='privacy-policy'), path('about/terms-and-conditions/', TermsView.as_view(), name='terms-and-conditions'), # Accounts App path('accounts/', include(accounts_patterns)), # API path('api/', include(api_patterns)), # Testing errors path('test/403', Test403View.as_view()), path('test/404', Test404View.as_view()), path('test/500', Test500View.as_view()),
from django.conf.urls import patterns, include, url from views import AboutView, WikiPageView, RootPageView, WikiPageUpdate, WikiPageDelete, WikiPageCreate # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() from django.contrib import admin admin.autodiscover() handler404 = 'wiki_ab.views.wiki_page_not_found' urlpatterns = patterns('', # Examples: # url(r'^$', 'wiki_ab.views.home', name='home'), # url(r'^wiki_ab/', include('wiki_ab.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: # url(r'^admin/', include(admin.site.urls)), url('^$', RootPageView.as_view (), name="rootpage"), url(r'^admin/', include(admin.site.urls)), (r'^about/$', AboutView.as_view()), (r'(^([^/]+)/)*(add/|add)$', WikiPageCreate.as_view()), (r'(^([^/]+)/)*(edit/|edit)$', WikiPageUpdate.as_view()), (r'(^([^/]+)/)*(delete/|delete)$', WikiPageDelete.as_view()), (r'(^([^/]+)/)*$', WikiPageView.as_view()), )
from django.conf.urls import patterns, url from views import IndexView, DetailView, AboutView, ContactView urlpatterns = patterns( 'immuno.views', url(r'^$', IndexView.as_view(), name='immuno'), url(r'^about/$', AboutView.as_view(), {'slug': 'about-immunology-lab'}, name='immuno-about'), url(r'^contact/$', ContactView.as_view(), {'slug': 'contact-immunology-lab'}, name='immuno-contact'), url(r'^(?P<slug>.+)', DetailView.as_view(), name='immuno-entry'), )
from django.conf.urls import patterns, include, url from django.views.generic import ListView, TemplateView from django.utils.timezone import now # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() from views import HomeView, AboutView from schedule.models import Event urlpatterns = patterns('', # Examples: #url(r'^$', 'mpython.views.home', name='home'), url(r'^$', HomeView.as_view(), name='home'), url(r'^about/$', AboutView.as_view(), name='about'), url(r'^contribution/$', TemplateView.as_view(template_name='contribution.html'), name='contribute'), # url(r'^mpython/', include('mpython.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), # Account related url(r'^accounts/', include('accounts.urls')), url(r'^accounts/', include('userena.urls')), # For Events
from django.conf.urls import patterns, url from views import AboutView urlpatterns = patterns('', url(r'^$', AboutView.as_view()), )
'grade.views', url(r'^palestras/$', TalkListView.as_view(), name='talks'), url(r'^$', IndexView.as_view(), name='index'), url(r'^palestras/(?P<pk>\d+)/$', TalkDetailView.as_view(), name='talk'), url(r'^palestras/(?P<talk_id>\d+)/assistir/$', "choice_talk", name="choice_talk"), url(r"^gerar_grade/", 'gerar_grade', name="gerar_grade"), url(r'^palestrantes/(?P<pk>\d+)/$', AuthorDetailView.as_view(), name='author'), url(r'^trilhas/$', ListView.as_view(model=Zone, context_object_name="zone_list")), url(r'^trilhas/(?P<pk>\d+)/$', ZoneDetailView.as_view(), name='zone'), url(r'^salas/$', ListView.as_view(model=Room, context_object_name="rooms")), url(r'^salas/(?P<pk>\d+)/$', RoomDetailView.as_view(), name='room'), url(r'^dia/(\w+)/$', DayTalkListView.as_view()), url( r'^dia/$', ListView.as_view(queryset=Talk.objects.dates("date", "day"), template_name="grade/days_list.html", context_object_name="days")), url(r'^agora/$', NowListView.as_view(), name='now'), url(r'^sobre/$', AboutView.as_view(), name='about'), url(r'^busca/$', SearchTalkListView.as_view()), url(r'^code/$', RedirectView.as_view(url='https://github.com/willemarcel/gradefisl'), name='code'), )
from django.conf.urls import patterns, url from views import IndexView, DetailView, AboutView, ContactView urlpatterns = patterns( "immuno.views", url(r"^$", IndexView.as_view(), name="immuno"), url(r"^about/$", AboutView.as_view(), {"slug": "about-immunology-lab"}, name="immuno-about"), url(r"^contact/$", ContactView.as_view(), {"slug": "contact-immunology-lab"}, name="immuno-contact"), url(r"^(?P<slug>.+)", DetailView.as_view(), name="immuno-entry"), )
# url(r'^$', 'blog1.views.home', name='home'), # url(r'^blog1/', include('blog1.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url('^$', BlogMainView.as_view(), name="blogclass"), url(r'^admin/', include(admin.site.urls)), url(r'edit/(?P<pk>\d+)/$', MsgUpdate.as_view(), name='msg_update'), url(r'delete/(?P<pk>\d+)/$', MsgDelete.as_view(), name='msg_delete'), url(r'detail/(?P<pk>\d+)/$', MsgView.as_view(), name='msg_detail'), url(r'post/(?P<post>\d+)/$', BlogMainViewAnchor.as_view(), name='msg_post'), url(r'(?P<page>\d+)/$', BlogMainView.as_view()), (r'^about/$', AboutView.as_view()), (r'^accounts/login/$', GnsLoginFormView.as_view()), # login), # (r'^accounts/login/$', login), # ), (r'^accounts/logout/$', logout), ) if settings.DEBUG: urlpatterns += patterns( 'django.contrib.staticfiles.views', url(r'^static/(?P<path>.*)$', 'serve'), ) urlpatterns += patterns( '', (r'^meta/$', display_meta), url(r'^msg/$', MsgListView.as_view(), name="msglist"), )
from views import SimpleView, AboutView routes = {'/': SimpleView(), '/about/': AboutView()}
url(r'^descubre/(?P<category>\w+)/$', Category_view_filter.as_view(), name='subcategory'), url(r'^descubre/(?P<category>\w+)/(?P<subcategory>\w+)/$', Sub_category_view_filter.as_view(), name='detailsubcategory'), url(r'^encuentra/$', Users_view.as_view() , name='encuentra'), url(r'^register/$', Register.as_view(), name='register'), url(r'^login/$', Login.as_view(), name='login'), url(r'^register/perfil/$', Create_profile.as_view(), name='createprofile'), url(r'^logout/$', views.user_logout, name='logout'), url(r'^configuracion/(?P<username>\w+)/$', login_required(Settings.as_view()), name='settings'), url(r'^crea/$', login_required(Create_project.as_view()), name='create'), url(r'^crea/habilidad/$', login_required(Create_skill.as_view()), name='createSkill'), url(r'^froala_editor/', include('froala_editor.urls')), #url(r'^mensajes/', include('postman.urls', app_name='postman')), url(r'^colaborar/(?P<username>\w+)/(?P<slug>[-_\w]+)/$', login_required(views.register_collaborator), name='collaborate'), url(r'^colaboraciones/(?P<username>\w+)/(?P<tipo>\w+)/$', login_required(Trueques.as_view()), name='trueques'), url(r'^colaboraciones/cerrar/(?P<collaboration>\w+)/(?P<type_true>[0-9])/$', views.Close_trueque, name='cerrarTrueque'), url(r'^acerca_de_troca$', AboutView.as_view(), name='about'), url(r'^quienes_somos', OurPeople.as_view(), name='ourpeople'), (r'^mensajes/', include('django_messages.urls')), url(r'^feedback/', include('feedback_form.urls')), url(r'^cerrar_perfil/(?P<username>\w+)/$', views.cerrar_usuario, name='cerrarPerfil'), url(r'^cerrar_proyecto/(?P<username>\w+)/(?P<slug>[-_\w]+)/$', views.cerrar_proyecto, name='cerrarProyecto'), url(r'^nueva_contrasena/(?P<slug>\w+)/$', Set_Password.as_view(), name='nueva_contrasena'), url(r'^cambiar_contrasena/(?P<nombre_usuario>\w+)/$', solicitar_cambio_contrasena, name='solicitar_cambio_contrasena'), url(r'^cambiar_contrasena_usuario/(?P<contrasena>\w+)/(?P<nombre>\w+)/$', cambiar_contrasena_usuario, name='cambiar_contrasena_usuario'), url(r'^comentar/(?P<usernameComment>\w+)/(?P<projectSlug>[-_\w]+)/(?P<comment>\w+)/$', login_required(register_comment), name='register_comment'), url(r'^comentarios/(?P<slug>[-_\w]+)/$', ProjectComments.as_view(), name='get_project_comments'), url(r'^comentario/(?P<pk>[0-9]+)/$', ProjectComment.as_view(), name='get_comment'), url(r'^comentarios/usuario/(?P<slug>\w+)/$', UserComments.as_view(), name='get_user_comments'), ) urlpatterns += staticfiles_urlpatterns()
from django.conf.urls import patterns, url from django.views.generic import TemplateView from django.views.decorators.csrf import csrf_exempt from django.views.generic import DetailView from lifespan.views import VarianceDetail, VariantDetail, FactorDetail, Population, StudyType from views import BrowseView, HomeView, AboutView # SearchView, from datasets.views import detail urlpatterns = patterns('longevitydb.views', url(r'^$', HomeView.as_view(), name='longevitydb-home'), url(r'^about',AboutView.as_view(), name='longevitydb-about'), #url(r'^search/(?P<term>.?)', SearchView.as_view(), name='longevitydb-search'), url(r'^browse/(?P<model>.+)/(?P<type>.+)', csrf_exempt(BrowseView.as_view()), name='longevitydb-browse'), url(r'^search/$', 'search', name='longevitydb-search'), #SearchView.as_view() url(r'^search/(?P<keyword>.+)/', 'search', name='longevitydb-search'), #SearchView.as_view() url(r'^browse', csrf_exempt(BrowseView.as_view()), name='longevitydb-browse'), url(r'^legacy', TemplateView.as_view(template_name='longevitydb.html'), name='longevitydb'), url(r'^longevitydb', HomeView.as_view(), name='longevitydb-longevitydb'), url(r'^detail/(?P<pk>\d+)/$', VariantDetail.as_view(template_name='longevitydb/detail.html'), name='lvdb-variant'), url(r'^factor_detail/(?P<pk>\d+)/$', FactorDetail.as_view(template_name='longevitydb/factor_detail.html'), name='lvdb-factor_detail'), url(r'^population_detail/(?P<pk>\d+)/$', DetailView.as_view(model=Population, template_name='longevitydb/population_detail.html'), name='lvdb-population_detail'), url(r'^studytype_detail/(?P<pk>\d+)/$', DetailView.as_view(model=StudyType, template_name='longevitydb/studytype_detail.html'), name='lvdb-studytype_detail'), url(r'reference_detail/(?P<pk>\d+)', detail, {'template':'longevitydb/reference_detail.html'}, name='lvdb-reference_detail'), )
from views import IndexView, AboutView, OtherView routes = { '/': IndexView(), '/about/': AboutView(), '/other/': OtherView(), }