def decorator(function): function.route = routes.route(regex=regex, view=function.__name__, method=method, name=name) @wraps(function) def wrapper(self, *args, **kwargs): return function(self, *args, **kwargs) return wrapper
from respite.urls import resource, routes from views import GalleryViews, ImageViews urlpatterns = resource( prefix = '/galleries/', views = GalleryViews, routes = [ routes.route( regex = r'^(?:$|index(?:\.[a-zA-Z]+)?$)', view = 'create', method = 'POST', name = 'galleries', ), routes.route( regex = r'^(?:$|index(?:\.[a-zA-Z]+)?$)', view = 'index', method = 'GET', name = 'galleries', ), routes.route( regex = r'^(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?$', view = 'show', method = 'GET', name = 'gallery', ) ] ) urlpatterns += resource( prefix = '/galleries/',
#coding=utf-8 from django.conf.urls.defaults import * from respite.urls import resource, routes, templates from views import * urlpatterns = resource( prefix = '', views = TimelineViews, routes = [ # Route to backpack routes.route( regex = r'^chronology(?:\.[a-zA-Z]+)?(?:/(?P<page>[0-9]+))?/$', view = 'chronology', method = 'GET', name = 'timeline_chronology_user' ), routes.route( regex = r'^timeline(?:\.[a-zA-Z]+)?(?:/(?P<page>[0-9]+))?/$', view = 'timeline', method = 'GET', name = 'timeline_user' ), routes.route( regex = r'^timeline(?:\.[a-zA-Z]+)?/(?P<username>[^/]+)(?:/(?P<page>[0-9]+))?/$', view = 'timeline', method = 'GET', name = 'timeline_user' ), ]
from django.conf.urls import include, url from django.contrib import admin from django.conf import settings from django.views.generic import TemplateView from respite.urls import resource, routes, templates from shuttle.views import PostViews from django.views.generic import RedirectView from django.conf.urls.static import static urlpatterns = [url(r'^admin/', include(admin.site.urls))] urlpatterns += resource( views=PostViews, routes=[ routes.route(regex=r'^(?:$|index%s$)' % (templates.format), view='index', method='GET', name='main'), routes.route(regex=r'^upload%s$' % (templates.format), view='upload', method='GET', name='upload'), routes.route(regex=r'^upload%s$' % (templates.format), view='process_file', method='POST', name='process_file'), routes.route(regex=r'^(?P<campus>[a-zA-Z]+)%s$' % (templates.format), view='show', method='GET', name='routes'), routes.route(regex=r'^database_check%s$' % (templates.format), view='database_check',
from respite.urls import resource, routes from views import ArticleViews urlpatterns = resource( prefix = 'articles/', views = ArticleViews, routes = [ routes.index, routes.create, routes.show, routes.update, routes.replace, routes.delete, routes.edit, routes.new, routes.route( regex = lambda prefix: r'^%s(?P<id>[0-9]+)/preview(?:\.[a-zA-Z]+)?$' % prefix, view = 'preview', method = 'GET', name = lambda views: 'preview_%s_%s' % (views.model._meta.app_label, views.model.__name__.lower()) ) ] )
from respite.urls import resource, routes, templates from app_users.views import UserProfileViews urlpatterns = resource( prefix = 'users/', views = UserProfileViews, routes = [ #========================================================================= # INDEX - FORBIDDEN routes.route( regex = r'^(?:$|index%s$)' % (templates.format), view = 'index', method = 'GET', name = 'app_users.index' ), #========================================================================= # NEW - FORBIDDEN routes.route( regex = r'^new(?:/$|%s$)' % (templates.format), view = 'new', method = 'GET', name = 'app_users.new' ), #========================================================================= # CREATE - FORBIDDEN routes.route( regex = r'^(?:$|index%s$)' % (templates.format), view = 'create', method = 'POST', name = 'app_users.create' ),
#coding=utf-8 from django.conf.urls.defaults import * from respite.urls import resource, routes, templates from views import * urlpatterns = resource( prefix = '', views = ListSuggestionViews, routes = [ # Route to form for new suggestion routes.route( regex = r'^ls(?:\.[a-zA-Z]+)?/$', view = 'new', method = 'GET', name = 'lists_suggestion_add' ), # Route to add a new suggestion routes.route( regex = r'^ls(?:\.[a-zA-Z]+)?/$', view = 'create', method = 'POST', name = 'events_suggestion_new' ), # Route to list routes.route( regex = r'^ls/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/$', view = 'show', method = 'GET', name = 'events_suggestion_detail'
#coding=utf-8 from django.conf.urls.defaults import * from respite.urls import resource, routes, templates from views import * urlpatterns = resource( prefix = '', views = SuggestionViews, routes = [ # Route to backpack routes.route( regex = r'^(?P<username>[^/]+)/suggestions(?:\.[a-zA-Z]+)?/$', view = 'index', method = 'GET', name = 'events_suggestions_user' ), # Route to form for new suggestion routes.route( regex = r'^suggestion(?:\.[a-zA-Z]+)?/$', view = 'new', method = 'GET', name = 'events_suggestion_add' ), # Route to add a new suggestion routes.route( regex = r'^suggestion(?:\.[a-zA-Z]+)?/$', view = 'create', method = 'POST', name = 'events_suggestion_new'
from respite.urls import resource, routes, templates from app_collaborations.views import CollaborationViews urlpatterns = resource( prefix = 'collaborations/', views = CollaborationViews, routes = [ #========================================================================= # CHOOSE PROJECT routes.route( regex = r'^(?:$|index%s$)' % (templates.format), view = 'choose_project', method = 'GET', name = 'app_collaborations.choose_project' ), #========================================================================= # DEFINE PARAMETERS routes.route( regex = r'^(?P<id>[0-9]+)(?:/$|%s$)' % (templates.format), view = 'find_collaborators', method = 'GET', name = 'app_collaborations.find_collaborators' ), # DEFINE PARAMETERS routes.route( regex = r'^(?P<id>[0-9]+)(?:/$|%s$)' % (templates.format), view = 'find_collaborators', method = 'POST', name = 'app_collaborations.find_collaborators' ),
from django.views.generic import TemplateView from respite.urls import resource, routes, templates from shuttle.views import PostViews from django.views.generic import RedirectView from django.conf.urls.static import static urlpatterns = [ url(r'^admin/', include(admin.site.urls)) ] urlpatterns += resource( views = PostViews, routes = [ routes.route( regex = r'^(?:$|index%s$)' % (templates.format), view = 'index', method = 'GET', name = 'main' ), routes.route( regex = r'^upload%s$' % (templates.format), view = 'upload', method = 'GET', name = 'upload' ), routes.route( regex = r'^upload%s$' % (templates.format), view = 'process_file', method = 'POST', name = 'process_file' ), routes.route(
# coding=utf-8 from respite.urls import resource, routes, templates from views import * urlpatterns = resource( prefix = 'suggestion/', views = SuggestionViews, routes = [ # Route 'suggestions/' to the backpack view routes.route( regex = r'^(?:$|index(?:\.[a-zA-Z]+)/(?P<username>[^/]+)/$)', view = 'index', method = 'GET', name = 'events_suggestions_user' ), routes.route( regex = r'^create(?:\.[a-zA-Z]+)?/$', view = 'add', method = 'POST', name = 'api2_suggestion_create' ), routes.route( regex = r'^near(?:\.[a-zA-Z]+)?/(?P<lat>[^/]+)/(?P<lon>[^/]+)/(?P<accuracy>[0-9]+)/$', view = 'near', method = 'GET', name = 'api2_suggestion_update' ), routes.route(