コード例 #1
0
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/',
    views = ImageViews,
コード例 #2
0
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'
        ),
      ]
)
#
#import views as timelines_views
#
コード例 #3
0
ファイル: urls.py プロジェクト: espenhogbakk/django-respite
from django.utils.translation import ugettext_lazy as _

from respite.urls import resource

from .views import ArticleViews

urlpatterns = resource(
    prefix = _('articles/'),
    views = ArticleViews,
    routes = ArticleViews.routes + [
        ArticleViews.preview.route
    ]
)
コード例 #4
0
ファイル: urls.py プロジェクト: djromero/respite
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())
        )
    ]
)
コード例 #5
0
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',
                     method='GET',
                     name='database_check'),
        routes.route(regex=r'^database_fetch_all%s$' % (templates.format),
                     view='database_fetch_all',
                     method='GET',
                     name='database_fetch_all'),
    ])

urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
コード例 #6
0
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'
            ),
            # Route to form to edit a existing list
            routes.route(
                regex = r'^ls/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/edit/$',
                view = 'edit',
                method = 'GET',
                name = 'lists_suggestion_edit'
            ),
            # Route to update a existing list
            routes.route(
                regex = r'^ls/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/$',
                view = 'update',
                method = 'POST',
                name = 'lists_suggestion_detail'
            ),
  ]
)
コード例 #7
0
ファイル: urls.py プロジェクト: marco-lancini/Showcase
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'
        ),
        #=========================================================================
        # SHOW
        routes.route(
            regex = r'^(?P<username>\w+)(?:/$|%s$)' % (templates.format),
            view = 'show',
            method = 'GET',
            name = 'app_users.user_view'
        ),
        #=========================================================================
        # EDIT
        routes.route(            
            regex = r'^(?P<username>\w+)/edit(?:/$|%s$)' % (templates.format),
            view = 'edit',
            method = 'GET',
            name = 'app_users.user_edit'
        ),
        routes.route(            
            regex = r'^(?P<username>\w+)/edit(?:/$|%s$)' % (templates.format),
            view = 'edit',
            method = 'POST',
            name = 'app_users.user_edit'
        ),
        #=========================================================================
        # REPLACE
        routes.route(            
            regex = r'^(?P<username>\w+)(?:/$|%s$)' % (templates.format),
            view = 'replace',
            method = 'PUT',
            name = 'app_users.user_replace'
        ),
        #=========================================================================
        # UPDATE
        routes.route(            
            regex = r'^(?P<username>\w+)(?:/$|%s$)' % (templates.format),
            view = 'update',
            method = 'PATCH',
            name = 'app_users.user_update'
        ),
        #=========================================================================
        # DESTROY
        routes.route(            
            regex = r'^(?P<username>\w+)/destroy(?:/$|%s$)' % (templates.format),
            view = 'destroy',
            method = 'GET',
            name = 'app_users.user_destroy'
        ),
        routes.route(            
            regex = r'^(?P<username>\w+)/destroy(?:/$|%s$)' % (templates.format),
            view = 'destroy',
            method = 'DELETE',
            name = 'app_users.user_destroy'
        ),
        #=========================================================================
        # SETTINGS
        routes.route(            
            regex = r'^(?P<username>\w+)/settings(?:/$|%s$)' % (templates.format),
            view = 'settings',
            method = 'GET',
            name = 'app_users.user_settings'
        ),
        # SETTINGS EDIT
        routes.route(            
            regex = r'^(?P<username>\w+)/settings/edit(?:/$|%s$)' % (templates.format),
            view = 'settings_edit',
            method = 'GET',
            name = 'app_users.user_settings_edit'
        ),
        routes.route(            
            regex = r'^(?P<username>\w+)/settings/edit(?:/$|%s$)' % (templates.format),
            view = 'settings_edit',
            method = 'POST',
            name = 'app_users.user_settings_edit'
        ),
        #=========================================================================
        # LIST OF VOTED PROJECTS
        routes.route(            
            regex = r'^(?P<username>\w+)/voted(?:/$|%s$)' % (templates.format),
            view = 'voted',
            method = 'GET',
            name = 'app_users.user_voted'
        ),
        #=========================================================================
        # ADD CREATIVE FIELDS
        routes.route(            
            regex = r'^(?P<username>\w+)/fields(?:/$|%s$)' % (templates.format),
            view = 'creative_fields_manage',
            method = 'GET',
            name = 'app_users.user_fields'
        ),
        routes.route(            
            regex = r'^(?P<username>\w+)/fields(?:/$|%s$)' % (templates.format),
            view = 'creative_fields_manage',
            method = 'POST',
            name = 'app_users.user_fields'
        ),
        # DELETE CREATIVE FIELD
        routes.route(
            regex = r'^(?P<username>\w+)/fields/delete/(?P<field_id>\w+)(?:/$|%s$)' % (templates.format),
            view = 'creative_fields_delete',
            method = 'POST',
            name = 'app_users.creative_fields_delete'
        ),
        #=========================================================================
        # EMPLOYMENT
        routes.route(            
            regex = r'^(?P<username>\w+)/employment(?:/$|%s$)' % (templates.format),
            view = 'employment_manage',
            method = 'GET',
            name = 'app_users.user_employment'
        ),
        routes.route(            
            regex = r'^(?P<username>\w+)/employment(?:/$|%s$)' % (templates.format),
            view = 'employment_manage',
            method = 'POST',
            name = 'app_users.user_employment'
        ),
        # EMPLOYMENT FROM LINKEDIN
        routes.route(            
            regex = r'^(?P<username>\w+)/employment/linkedin(?:/$|%s$)' % (templates.format),
            view = 'employment_linkedin',
            method = 'GET',
            name = 'app_users.user_employment_linkedin'
        ),
        
    ]
)
コード例 #8
0
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'
        ),
        # Route to show a suggestion
        routes.route(
            regex = r'^suggestion/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/$',
            view = 'show',
            method = 'GET',
            name = 'events_suggestion_detail'
        ),
        routes.route(
            regex = r'^suggestion/(?P<slug>[^/.]+)(?:\.[a-zA-Z]+)?/$',
            view = 'show',
            method = 'GET',
            name = 'events_suggestion_detail'
        ),
        # Route to update a existing suggestion
        routes.route(
            regex = r'^suggestion/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/$',
            view = 'update',
            method = 'POST',
            name = 'events_suggestion_detail'
        ),
        routes.route(
            regex = r'^suggestion/(?P<slug>[^/.]+)(?:\.[a-zA-Z]+)?/$',
            view = 'update',
            method = 'POST',
            name = 'events_suggestion_detail'
        ),
        # Route to form to edit a existing suggestion
        routes.route(
            regex = r'^suggestion/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/edit/$',
            view = 'edit',
            method = 'GET',
            name = 'events_suggestion_edit'
        ),
        routes.route(
            regex = r'^suggestion/(?P<slug>[^/.]+)(?:\.[a-zA-Z]+)?/edit/$',
            view = 'edit',
            method = 'GET',
            name = 'events_suggestion_edit'
        ),
        # Route to get suggestions near
        routes.route(
            regex = r'^suggestions/near(?:\.[a-zA-Z]+)?/(?P<lat>[^/]+)/(?P<lon>[^/]+)/(?P<accuracy>[0-9]+)/$',
            view = 'near',
            method = 'GET',
            name = 'events_suggestions_near'
        ),
        # Route to form to edit a existing suggestion
        routes.route(
            regex = r'^suggestion/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/follow/$',
            view = 'follow',
            method = 'POST',
            name = 'events_suggestion_follow'
        ),
        # Route to form to edit a existing suggestion
        routes.route(
            regex = r'^suggestion/(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/$',
            view = 'destroy',
            method = 'DELETE',
            name = 'events_suggestion_delete'
        ),
    ]
)
コード例 #9
0
ファイル: urls.py プロジェクト: marco-lancini/Showcase
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'
        ),
        #=========================================================================
        # CALCULATE RESULTS
        routes.route(
            regex = r'^(?P<id>[0-9]+)/results(?:/$|%s$)' % (templates.format),
            view = 'calculate_results',
            method = 'GET',
            name = 'app_collaborations.calculate_results'
        ),
    ]
)
コード例 #10
0
from respite.urls import resource

from .views import ArticleViews

urlpatterns = resource(prefix='articles/',
                       views=ArticleViews,
                       routes=ArticleViews.routes +
                       [ArticleViews.preview.route])
コード例 #11
0
ファイル: urls.py プロジェクト: LaborWorks/bilgi-shuttle-api
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',
            method = 'GET',
            name = 'database_check'
        ),
        routes.route(
            regex = r'^database_fetch_all%s$' % (templates.format),
            view = 'database_fetch_all',
            method = 'GET',
            name = 'database_fetch_all'
        ),
    ]
)
コード例 #12
0
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(
            regex = r'^(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/$',
            view = 'show',
            method = 'GET',
            name = 'api2_suggestion_detail'
        ),
        routes.route(
            regex = r'^(?P<id>[0-9]+)(?:\.[a-zA-Z]+)?/$',
            view = 'update',
            method = 'POST',
            name = 'api2_suggestion_update'
        ),
    ]
)