示例#1
0
 url(r'^forum/$', 'occupywallst.views.forum', name='forum'),
 url(r'^forum/(?P<slug>[-_\d\w]+)/$', 'occupywallst.views.thread', name='forum-post'),
 url(r'^notification/(?P<id>\d+)/$', 'occupywallst.views.notification', name='notification'),
 url(r'^rides/$', 'occupywallst.views.rides', name='rides'),
 url(r'^rides/(?P<ride_id>\d+)/$', 'occupywallst.views.ride_info', name='ride_info'),
 url(r'^rides/create/$', 'occupywallst.views.ride_create', name='ride_create'),
 url(r'^rides/(?P<ride_id>\d+)/edit/$', 'occupywallst.views.ride_edit', name='ride_edit'),
 url(r'^rides/(?P<ride_id>\d+)/request/$', 'occupywallst.views.ride_request_add', name='ride_request'),
 url(r'^rides/(?P<ride_id>\d+)/request/delete/$', 'occupywallst.views.ride_request_delete', name='ride_request_delete'),
 url(r'^login/$', 'occupywallst.views.login', name='login'),
 url(r'^logout/$', 'occupywallst.views.logout', name='logout'),
 url(r'^signup/$', 'occupywallst.views.signup', name='signup'),
 url(r'^error/$', 'occupywallst.views.error', name='error'),
 url(r'^users/(?P<username>[-_\d\w]+)/$', 'occupywallst.views.user_page', name='user'),
 url(r'^users/(?P<username>[-_\d\w]+)/edit/$', 'occupywallst.views.edit_profile', name='user-edit'),
 url(r'^api/safe/attendees/$', require_GET(utils.api_view(api.attendees))),
 url(r'^api/safe/attendee_info/$', require_GET(utils.api_view(api.attendee_info))),
 url(r'^api/safe/rides/$', require_GET(utils.api_view(api.rides))),
 url(r'^api/ride_request_update/$', require_POST(utils.api_view(api.ride_request_update)), name="ride_request_update"),
 url(r'^api/safe/article_get/$', require_GET(utils.api_view(api.article_get))),
 url(r'^api/safe/article_get_comments/$', require_GET(utils.api_view(api.article_get_comments))),
 url(r'^api/safe/article_get_comment_votes/$', require_GET(utils.api_view(api.article_get_comment_votes))),
 url(r'^api/safe/comment_get/$', require_GET(utils.api_view(api.comment_get))),
 url(r'^api/safe/carousel_get/$', require_GET(utils.api_view(api.carousel_get))),
 url(r'^api/safe/forumlinks/$', require_GET(utils.api_view(api.forumlinks))),
 url(r'^api/article_new/$', require_POST(utils.api_view(api.article_new))),
 url(r'^api/article_edit/$', require_POST(utils.api_view(api.article_edit))),
 url(r'^api/article_delete/$', require_POST(utils.api_view(api.article_delete))),
 url(r'^api/article_remove/$', require_POST(utils.api_view(api.article_remove))),
 url(r'^api/comment_new/$', require_POST(utils.api_view(api.comment_new))),
 url(r'^api/comment_edit/$', require_POST(utils.api_view(api.comment_edit))),
示例#2
0
from rideshare import views, admin
from occupywallst import utils

urlpatterns = patterns(
    'rideshare',
    #rides
    url(r'^$', 'views.rides', name='rides'),
    url(r'^create/$', 'views.ride_create', name='ride_create'),
    url(r'^(?P<ride_id>\d+)/$', 'views.ride_info', name='ride_info'),
    url(r'^(?P<ride_id>\d+)/delete/$', 'views.ride_delete',
        name='ride_delete'),
    url(r'^(?P<ride_id>\d+)/edit/$', 'views.ride_edit', name='ride_edit'),
    #ride requests
    url(r'^(?P<request_id>\d+)/request/view/$',
        'views.ride_request_view',
        name='ride_request_view'),
    url(r'^(?P<ride_id>\d+)/request/add/$',
        'views.ride_request_add_update',
        name='ride_request_add_update'),
    url(r'^(?P<ride_id>\d+)/request/delete/$',
        'views.ride_request_delete',
        name="ride_request_delete"),
    #ride ajax
    url(r'^api/safe/rides/$', require_GET(utils.api_view(views.rides_get))),
    url(r'^api/ride_request_update/$',
        require_POST(utils.api_view(views.ride_request_update)),
        name="ride_request_update"),
    #url(r'^api/ride_edit_rendezvous/$', require_POST(utils.api_view(views.ride_edit_rendezvous)), name="ride_edit_rendezvous"),
)
示例#3
0
from mia_core.views import RedirectView
from . import converters, views

register_converter(converters.PeriodConverter, "period")
register_converter(converters.AccountConverter, "account")
register_converter(converters.CashAccountConverter, "cash-account")
register_converter(converters.LedgerAccountConverter, "ledger-account")
register_converter(converters.TransactionTypeConverter, "txn-type")
register_converter(converters.TransactionConverter, "txn")
register_converter(converters.DateConverter, "date")

app_name = "accounting"
urlpatterns = [
    path("", require_GET(RedirectView.as_view(
        query_string=True,
        pattern_name="accounting:cash.home",
    )), name="home"),
    path("cash",
         views.CashDefaultView.as_view(), name="cash.home"),
    path("cash/<cash-account:account>/<period:period>",
         views.cash, name="cash"),
    path("cash-summary",
         views.CashSummaryDefaultView.as_view(), name="cash-summary.home"),
    path("cash-summary/<cash-account:account>",
         views.cash_summary, name="cash-summary"),
    path("ledger",
         views.LedgerDefaultView.as_view(), name="ledger.home"),
    path("ledger/<ledger-account:account>/<period:period>",
         views.ledger, name="ledger"),
    path("ledger-summary",
         views.LedgerSummaryDefaultView.as_view(), name="ledger-summary.home"),
示例#4
0
 url(r'^rides/(?P<ride_id>\d+)/request/$', 'occupywallst.views.ride_request_add', name='ride_request'),
 url(r'^rides/(?P<ride_id>\d+)/request/delete/$', 'occupywallst.views.ride_request_delete', name='ride_request_delete'),
 url(r'^calendar/$', 'occupywallst.views.calendar', name='calendar'),
 url(r'^chat/$', 'occupywallst.views.chat', name='chat'),
 url(r'^chat/(?P<room>[a-zA-Z0-9]+)/$', 'occupywallst.views.chat', name='chat-private'),
 url(r'^housing/$', 'occupywallst.views.housing', name='housing'),
 url(r'^conference/$', 'occupywallst.views.conference', name='conference'),
 url(r'^donate/$', 'occupywallst.views.donate', name='donate'),
 url(r'^about/$', 'occupywallst.views.about', name='about'),
 url(r'^login/$', 'occupywallst.views.login', name='login'),
 url(r'^logout/$', 'occupywallst.views.logout', name='logout'),
 url(r'^signup/$', 'occupywallst.views.signup', name='signup'),
 url(r'^error/$', 'occupywallst.views.error', name='error'),
 url(r'^users/(?P<username>[-_\d\w]+)/$', 'occupywallst.views.user_page', name='user'),
 url(r'^users/(?P<username>[-_\d\w]+)/edit/$', 'occupywallst.views.edit_profile', name='user-edit'),
 url(r'^api/safe/attendees/$', require_GET(utils.api_view(api.attendees))),
 url(r'^api/safe/attendee_info/$', require_GET(utils.api_view(api.attendee_info))),
 url(r'^api/safe/rides/$', require_GET(utils.api_view(api.rides))),
 url(r'^api/ride_request_update/$', require_POST(utils.api_view(api.ride_request_update)), name="ride_request_update"),
 url(r'^api/safe/article_get/$', require_GET(utils.api_view(api.article_get))),
 url(r'^api/safe/comment_get/$', utils.api_view(api.comment_get)),
 url(r'^api/safe/forumlinks/$', utils.api_view(api.forumlinks)),
 url(r'^api/article_new/$', require_POST(utils.api_view(api.article_new))),
 url(r'^api/article_edit/$', require_POST(utils.api_view(api.article_edit))),
 url(r'^api/article_delete/$', require_POST(utils.api_view(api.article_delete))),
 url(r'^api/comment_new/$', require_POST(utils.api_view(api.comment_new))),
 url(r'^api/comment_edit/$', require_POST(utils.api_view(api.comment_edit))),
 url(r'^api/comment_remove/$', require_POST(utils.api_view(api.comment_remove))),
 url(r'^api/comment_delete/$', require_POST(utils.api_view(api.comment_delete))),
 url(r'^api/comment_upvote/$', require_POST(utils.api_view(api.comment_upvote))),
 url(r'^api/comment_downvote/$', require_POST(utils.api_view(api.comment_downvote))),
示例#5
0
文件: urls.py 项目: MarcelDrugi/books
from django.urls import path
from django.views.decorators.http import require_GET, require_POST
from . import views

app_name = 'books'

urlpatterns = [
    path('', views.InfoView.as_view(), name='info'),
    path('doc', views.DocView.as_view(), name='doc'),
    path('v1/books/<str:id>',
         require_GET(views.SingleBookView.as_view()),
         name='single_book'),
    path('v1/books',
         require_GET(views.ListBooksView.as_view()),
         name='book_list'),
    path('v1/db', require_POST(views.ListBooksView.as_view()), name='db'),
]
示例#6
0
 def as_view(cls, *args, **kwargs):
     return require_GET(
         super(PrimarySourceTable, cls).as_view(*args, **kwargs))
示例#7
0
from django.conf.urls import url
from django.views.decorators.http import require_GET, require_POST

from . import views

app_name = 'kitty'
urlpatterns = [
    url(r'^$',
        require_GET(views.BudgetListView.as_view()),
        name='budget/list'),
    url(r'^create/$',
        require_POST(views.budget_create),
        name='budget/create'),
    url(r'^(?P<pk>[a-zA-Z0-9]+)/$',
        require_GET(views.BudgetDetailView.as_view()),
        name='budget/detail'),
    url(r'^(?P<pk>[a-zA-Z0-9]+)/admin/(?P<admin_token>[a-zA-Z0-9]+)/$',
        require_GET(views.BudgetAdminDetailView.as_view()),
        name='budget/admin/detail'),
    url(r'^(?P<pk>[a-zA-Z0-9]+)/admin/(?P<admin_token>[a-zA-Z0-9]+)/update/$',
        require_POST(views.budget_admin_update),
        name='budget/admin/update'),
    url(r'^(?P<budget_id>[a-zA-Z0-9]+)/financial_contributions/create/$',
        require_POST(views.financial_contribution_create),
        name='financial_contribution/create'),
    url(r'^financial_contributions/(?P<pk>[0-9]+)/admin/(?P<admin_token>[a-zA-Z0-9]+)/confirm/$',
        require_POST(views.financial_contribution_admin_confirm),
        name='financial_contribution/admin/confirm'),
    url(r'^financial_contributions/(?P<pk>[0-9]+)/admin/(?P<admin_token>[a-zA-Z0-9]+)/cancel/$',
        require_POST(views.financial_contribution_admin_cancel),
        name='financial_contribution/admin/cancel'),
from django.utils.functional import allow_lazy, lazy, memoize
from django.views.decorators.http import require_http_methods, require_GET, require_POST
from django.views.decorators.vary import vary_on_headers, vary_on_cookie
from django.views.decorators.cache import cache_page, never_cache, cache_control
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
from django.contrib.admin.views.decorators import staff_member_required

def fully_decorated(request):
    """Expected __doc__"""
    return HttpResponse('<html><body>dummy</body></html>')
fully_decorated.anything = "Expected __dict__"

# django.views.decorators.http
fully_decorated = require_http_methods(["GET"])(fully_decorated)
fully_decorated = require_GET(fully_decorated)
fully_decorated = require_POST(fully_decorated)

# django.views.decorators.vary
fully_decorated = vary_on_headers('Accept-language')(fully_decorated)
fully_decorated = vary_on_cookie(fully_decorated)

# django.views.decorators.cache
fully_decorated = cache_page(60*15)(fully_decorated)
fully_decorated = cache_control(private=True)(fully_decorated)
fully_decorated = never_cache(fully_decorated)

# django.contrib.auth.decorators
# Apply user_passes_test twice to check #9474
fully_decorated = user_passes_test(lambda u:True)(fully_decorated)
fully_decorated = login_required(fully_decorated)
示例#9
0
 def as_view(cls, *args, **kwargs):
     return require_GET(super(ItemTable, cls).as_view(*args,
                                                      **kwargs))
示例#10
0
 def as_view(cls, *args, **kwargs):
     return require_GET(super(PrimarySourceTable, cls).as_view(*args,
                                                               **kwargs))
示例#11
0
from django.conf.urls import url
from django.views.decorators.cache import cache_page
from django.views.decorators.http import require_POST, require_GET

from .models import Post
from .views import *
from django.conf import settings

urlpatterns = [
    url(r'^posts/$', cache_page(60)(PostList.as_view()), name="post_list"),
    url(r'^posts/(?P<pk>[0-9]*)/$', PostView.as_view(), name="blog_post"),
    url(r'^posts/(?P<pk>[0-9]*)/getlike/$',
        login_required(require_GET(get_likes)),
        name="post_getlikes"),
    url(r'^posts/(?P<pk>[0-9]*)/getcomms/',
        login_required(require_GET(get_comms)),
        name="post_getcomms"),
    url(r'^$', cache_page(60)(LatestList.as_view()), name="latest_list"),
    url(r'^posts/(?P<pk>[0-9]*)/edit/$', EditPost.as_view(), name="edit_post"),
    url(r'^posts/new/$', login_required(NewPost.as_view()), name="new_post"),
    url(r'^posts/setlike/$',
        login_required(require_POST(catch_like_view)),
        name='setlike')
]
示例#12
0
def api_get(f):
    return api_ajax(require_GET(f))
示例#13
0
         name="deploy_bot"),
    path(
        "bot/<int:pk>/deactivate",
        views.DeactivateBotView.as_view(),
        name="deactivate_bot",
    ),
    path("bot/<int:pk>/activate",
         views.ActivateBotView.as_view(),
         name="activate_bot"),
    path(
        "account/aws/create",
        require_POST(views.AWSAccount.as_view()),
        name="aws_account_create",
    ),
    path(
        "account/aws/delete/<int:pk>",
        require_GET(views.AWSAccount.as_view()),
        name="aws_account_delete",
    ),
    path(
        "account/exchange/create",
        require_POST(views.ExchangeAccount.as_view()),
        name="exchange_account_create",
    ),
    path(
        "account/exchange/delete/<int:pk>",
        require_GET(views.ExchangeAccount.as_view()),
        name="exchange_account_delete",
    ),  # noqa
]
示例#14
0
from django.conf.urls.defaults import url, patterns, include
from django.views.decorators.http import require_GET, require_POST
from . import views, admin
from occupywallst import utils
 
#adminsite = admin.AdminSite(name='rideshareadmin') 

urlpatterns = patterns('rideshare',
    #rides
    url(r'^$', 'views.rides', name='rides'),
    url(r'^create/$', 'views.ride_create', name='ride_create'),
    url(r'^(?P<ride_id>\d+)/$', 'views.ride_info', name='ride_info'),
    url(r'^(?P<ride_id>\d+)/delete/$', 'views.ride_delete', name='ride_delete'),
    url(r'^(?P<ride_id>\d+)/edit/$', 'views.ride_edit', name='ride_edit'),
    #ride requests
    url(r'^(?P<request_id>\d+)/request/view/$', 'views.ride_request_view', name='ride_request_view'),
    url(r'^(?P<ride_id>\d+)/request/add/$', 'views.ride_request_add_update', name='ride_request_add_update'),
    url(r'^(?P<ride_id>\d+)/request/delete/$', 'views.ride_request_delete', name="ride_request_delete"),
    #ride ajax
    url(r'^api/safe/rides/$', require_GET(utils.api_view(views.rides_get))),
    url(r'^api/ride_request_update/$', require_POST(utils.api_view(views.ride_request_update)), name="ride_request_update"),
    #url(r'^api/ride_edit_rendezvous/$', require_POST(utils.api_view(views.ride_edit_rendezvous)), name="ride_edit_rendezvous"),  
    #url(r'^admin/', include(adminsite.urls)),
)
示例#15
0
from django.conf.urls import url
from django.views.decorators.http import require_POST, require_http_methods, require_GET

from mobile import cronjobs
from mobile.views import orders, couriers, issues

mobileUrls = [
    url(r'^api/mobile/order/$',
        require_POST(orders.getOrders),
        name='get-orders'),
    url(r'^api/mobile/order/home/$',
        require_POST(orders.getHomeOrders),
        name='get-home-orders'),
    url(r'^api/mobile/order/(?P<order_id>\d+)$',
        require_GET(orders.getOrder),
        name='get-order'),
    url(r'^api/mobile/order/courier/(?P<order_id>\d+)$',
        require_GET(orders.getCourierOrder),
        name='get-courier-order'),
    url(r'^api/mobile/order/courier/new/(?P<order_id>\d+)$',
        require_GET(orders.getNewCourierOrder),
        name='get-courier-order'),
    url(r'^api/mobile/order/create/$',
        require_POST(orders.createOrder),
        name='create-orders'),
    url(r'^api/mobile/order/courier/$',
        require_POST(orders.getCourierOrders),
        name='get-courier-orders'),
    url(r'^api/mobile/order/courier/home/$',
        require_POST(orders.getCourierHomeOrders),
        name='get-home-courier-orders'),
示例#16
0
    form_class = forms.IndexForm
    success_url = reverse_lazy("restaurant:index")

    def form_valid(self, form):
        dishes = form.cleaned_data["dishes"]
        total_price = sum(dish.price for dish in dishes)
        allergens = {
            allergen
            for dish in dishes.prefetch_related("allergens")
            for allergen in dish.allergens.all()
        }
        return TemplateResponse(self.request,
                                "restaurant/order.html",
                                context={
                                    "total_price": total_price,
                                    "dishes": dishes,
                                    "allergens": allergens
                                })

    def get_context_data(self, **kwargs):
        kwargs["create_dish_form"] = forms.CreateDishForm(prefix="create_dish")
        return super().get_context_data(**kwargs)


index = require_GET(IndexView.as_view())
order = require_POST(IndexView.as_view())


class CreatePasteView(TemplateView):
    template_name = "restaurant/paste.html"
示例#17
0
from django.urls import path
from django.views.decorators.http import require_POST, require_GET

from accounts.views import AddAccounts

urlpatterns = [
    path('account/user/register/', require_GET(AddAccounts.as_view())),  # 用户注册
]
示例#18
0
"""Ecommerce 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 django.views.decorators.http import require_GET
from .views import Homepage, ProductDetail, CategoryList, SearchList
app_name = "home"
urlpatterns = [
    path('', Homepage.as_view(), name="homepage"),
    path('product/<int:pk>/', ProductDetail.as_view(), name="product_detail"),
    path('category/<str:slug>/', CategoryList.as_view(), name="category_list"),
    path('search/', require_GET(SearchList.as_view()), name="search_products")
]
示例#19
0
     services.createService,
     name='create-service'),
 url(r'^api/service/courierPartnerCost/$',
     services.courierPartnerCost,
     name='service-courier-cost'),
 url(r'^api/service/(?P<service_id>\d+)$',
     require_http_methods(['GET'])(services.getService),
     name='get-service'),
 url(r'^api/service/delete/(?P<service_id>\d+)$',
     require_http_methods(['DELETE'])(services.deleteService),
     name='delete-service'),
 url(r'^api/service/edit/$',
     require_http_methods(['PUT'])(services.editService),
     name='edit-service'),
 url(r'^api/service/$',
     require_GET(services.getServices),
     name='get-services'),
 url(r'^api/service/toggleEnable/$',
     services.toggleEnable,
     name='toggle-services'),
 url(r'^api/service/singleToggleEnable/$',
     services.singleToggleEnable,
     name='single-toggle-services'),
 url(r'^api/service/searchQuickForwarders/$',
     services.quickSearchForwarders,
     name='quick-search-forwarders'),
 url(r'^api/service/searchForwarders/$',
     services.searchP2PForwarders,
     name='search-forwarders'),
 url(r'^api/service/searchPackageCollectors/$',
     services.searchPackageCollectors,
示例#20
0
     'occupywallst.views.ride_request_add',
     name='ride_request'),
 url(r'^rides/(?P<ride_id>\d+)/request/delete/$',
     'occupywallst.views.ride_request_delete',
     name='ride_request_delete'),
 url(r'^login/$', 'occupywallst.views.login', name='login'),
 url(r'^logout/$', 'occupywallst.views.logout', name='logout'),
 url(r'^signup/$', 'occupywallst.views.signup', name='signup'),
 url(r'^error/$', 'occupywallst.views.error', name='error'),
 url(r'^users/(?P<username>[-_\d\w]+)/$',
     'occupywallst.views.user_page',
     name='user'),
 url(r'^users/(?P<username>[-_\d\w]+)/edit/$',
     'occupywallst.views.edit_profile',
     name='user-edit'),
 url(r'^api/safe/attendees/$', require_GET(utils.api_view(api.attendees))),
 url(r'^api/safe/attendee_info/$',
     require_GET(utils.api_view(api.attendee_info))),
 url(r'^api/safe/rides/$', require_GET(utils.api_view(api.rides))),
 url(r'^api/ride_request_update/$',
     require_POST(utils.api_view(api.ride_request_update)),
     name="ride_request_update"),
 url(r'^api/safe/article_get/$',
     require_GET(utils.api_view(api.article_get))),
 url(r'^api/safe/article_get_comments/$',
     require_GET(utils.api_view(api.article_get_comments))),
 url(r'^api/safe/article_get_comment_votes/$',
     require_GET(utils.api_view(api.article_get_comment_votes))),
 url(r'^api/safe/comment_get/$',
     require_GET(utils.api_view(api.comment_get))),
 url(r'^api/safe/carousel_get/$',
示例#21
0
 def as_view(cls, *args, **kwargs):
     return require_GET(super(ItemTable, cls).as_view(*args, **kwargs))