예제 #1
0
class App(crapp.App):
    appurls = [
        crapp.Url(r'^$',
                  ensure_csrf_cookie(AdminPublicDiscussView.as_view()),
                  name=crapp.INDEXVIEW_NAME),
        crapp.Url(r'^admin-examiner-discuss$',
                  ensure_csrf_cookie(AdminWithExaminersDiscussView.as_view()),
                  name='admin-examiner-discuss')
    ]
class App(crapp.App):
    appurls = [
        crapp.Url(
            r'^$',
            ensure_csrf_cookie(StudentFeedbackFeedView.as_view()),
            name=crapp.INDEXVIEW_NAME),
        crapp.Url(
            r'^groupcomment-edit/(?P<pk>\d+)$',
            ensure_csrf_cookie(StudentEditGroupComment.as_view()),
            name='groupcomment-edit')
    ]
예제 #3
0
class App(crapp.App):
    appurls = [
        crapp.Url(r'^$',
                  ensure_csrf_cookie(AdminPublicDiscussView.as_view()),
                  name=crapp.INDEXVIEW_NAME),
        crapp.Url(r'^admin-examiner-discuss$',
                  ensure_csrf_cookie(AdminWithExaminersDiscussView.as_view()),
                  name='admin-examiner-discuss'),
        crapp.Url(r'^groupcomment-edit/(?P<pk>\d+)$',
                  ensure_csrf_cookie(AdminEditGroupCommentView.as_view()),
                  name='groupcomment-edit')
    ]
예제 #4
0
def get_ui_urlpatterns(ui_urlpatterns):
    ui_patterns = [
        re_path(pattern, ensure_csrf_cookie(IndexView.as_view()), name="index")
        for pattern in ui_urlpatterns
    ]
    return [
        re_path(r"^$", ensure_csrf_cookie(IndexView.as_view()), name="index"),
        re_path(r"^{}$".format(UI_V1),
                ensure_csrf_cookie(IndexView.as_view()),
                name="ui"),
        re_path(r"^{}/".format(UI_V1),
                include((ui_patterns, "ui_v1"), namespace="ui_v1")),
    ]
예제 #5
0
    def as_view(self, view, cacheable=False, extra_permission=None):
        """
        Wraps a view in authentication/caching logic

        extra_permission can be used to require an extra permission for this view, such as a module permission
        """

        def inner(request, *args, **kwargs):
            if not self.has_permission(request, extra_permission):
                # show login pane
                return self.login(request)
            return view(request, *args, **kwargs)

        # Mark it as never_cache
        if not cacheable:
            inner = never_cache(inner)

        # We add csrf_protect here so this function can be used as a utility
        # function for any view, without having to repeat 'csrf_protect'.
        if not getattr(view, "csrf_exempt", False):
            inner = csrf_protect(inner)

        inner = ensure_csrf_cookie(inner)

        return update_wrapper(inner, view)
예제 #6
0
def apply_decorators(  # noqa: C901
        view=None,
        login=False,
        staff=False,
        perms=None,
        cache=None,
        gzip=False,
        xframe=None,
        csrf=None,
        decorators=(),
):
    """
    Apply decorators to view function. Can also be used as a decorator.
    """

    if view is None:
        kwargs = locals()
        kwargs.pop("view")
        return lambda view: apply_decorators(view, **kwargs)

    # Cache control
    if cache is False:
        view = never_cache(view)
    elif cache is not None:
        view = cache_control(**cache)(view)

    # Permissions
    # (We keep the implementation here, but those options are not handled by
    #  this decorator anymore).
    if login:
        view = login_required(view)
    if perms:
        view = permission_required(perms)(view)
    if staff:
        view = staff_required(view)

    # Compression
    if gzip:
        view = gzip_page(view)

    # Security
    if xframe is False:
        view = xframe_options_exempt(view)
    elif xframe == "deny":
        view = xframe_options_deny(view)
    elif xframe == "sameorigin":
        view = xframe_options_sameorigin(view)
    if csrf is False:
        view = csrf_exempt(view)
    elif csrf == "cookie":
        view = ensure_csrf_cookie(view)
    elif csrf == "token":
        view = requires_csrf_token(view)
    elif csrf is True:
        view = csrf_protect(view)

    # Apply final decorators
    for decorator in reversed(decorators):
        view = decorator(view)
    return view
예제 #7
0
    def as_view(self, view, cacheable=False, extra_permission=None):
        """
        Wraps a view in authentication/caching logic

        extra_permission can be used to require an extra permission for this view, such as a module permission
        """
        @wraps(view)
        def inner(request, *args, **kwargs):
            if not user_is_authenticated(request.user):
                return self.login(request)
            elif not self.has_permission(request, extra_permission):
                raise PermissionDenied()
            return view(request, *args, **kwargs)

        # Mark it as never_cache
        if not cacheable:
            inner = never_cache(inner)

        # We add csrf_protect here so this function can be used as a utility
        # function for any view, without having to repeat 'csrf_protect'.
        if not getattr(view, 'csrf_exempt', False):
            inner = csrf_protect(inner)

        inner = ensure_csrf_cookie(inner)

        return update_wrapper(inner, view)
class App(crapp.App):
    appurls = [
        crapp.Url(
            r'^$',
            ensure_csrf_cookie(StudentFeedbackFeedView.as_view()),
            name=crapp.INDEXVIEW_NAME),
    ]
예제 #9
0
def get_ui_urlpatterns(ui_urlpatterns):
    return [
        re_path(
            pattern,
            ensure_csrf_cookie(IndexView.as_view()),
            name="index",
        ) for pattern in ui_urlpatterns
    ]
예제 #10
0
 def wrapper(req, *args, **kwargs):
     if req.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
         return (ensure_csrf_cookie(func))(req, *args, **kwargs)
         # Default cookie by CSRF_COOKIE_NAME in settings is 'csrftoken'
         # submit back in either req.form['csrfmiddlewaretoken'] or req['X-CSRFToken']
         # the latter often used by Ajax and can be configured by CSRF_HEADER_NAME in settings
     else:
         func.csrf_exempt = False  # reset csrf_exempt set by @csrf_exempt during @service
         return (csrf_protect(func))(req, *args, **kwargs)
예제 #11
0
def apply_decorators(
    view=None,
    login=False,
    staff=False,
    perms=None,  # noqa: C901
    cache=None,
    gzip=False,
    xframe=None,
    csrf=None,
    decorators=()):
    """
    Apply decorators to view function. Can also be used as a decorator.
    """

    if view is None:
        kwargs = locals()
        kwargs.pop('view')
        return lambda view: apply_decorators(view, **kwargs)

    # Cache control
    if cache is False:
        view = never_cache(view)
    elif cache is not None:
        view = cache_control(**cache)(view)

    # Permissions
    if login:
        view = login_required(view)
    if perms:
        view = permission_required(perms)(view)
    if staff:
        view = staff_required(view)

    # Compression
    if gzip:
        view = gzip_page(view)

    # Security
    if xframe is False:
        view = xframe_options_exempt(view)
    elif xframe == 'deny':
        view = xframe_options_deny(view)
    elif xframe == 'sameorigin':
        view = xframe_options_sameorigin(view)
    if csrf is False:
        view = csrf_exempt(view)
    elif csrf == 'cookie':
        view = ensure_csrf_cookie(view)
    elif csrf == 'token':
        view = requires_csrf_token(view)
    elif csrf is True:
        view = csrf_protect(view)

    # Apply final decorators
    for decorator in reversed(decorators):
        view = decorator(view)
    return view
예제 #12
0
    def get(self, request, *args, **kwargs):
        """ Introduces the ``ensure_csrf_cookie`` decorator and handles xeditable choices ajax. """
        if request.GET.get(self.xeditable_fieldname_param):
            return self.get_ajax_xeditable_choices(request, *args, **kwargs)

        # Doing this in the method body at runtime instead of at declaration-time helps prevent
        # collisions of other subclasses also trying to decorate their own get() methods.
        method = super(XEditableMixin, self).get
        method = ensure_csrf_cookie(method)
        return method(request, *args, **kwargs)
예제 #13
0
    def get(self, request, *args, **kwargs):
        """ Introduces the ``ensure_csrf_cookie`` decorator and handles xeditable choices ajax. """
        if request.GET.get(self.xeditable_fieldname_param):
            return self.get_ajax_xeditable_choices(request, *args, **kwargs)

        # Doing this in the method body at runtime instead of at declaration-time helps prevent
        # collisions of other subclasses also trying to decorate their own get() methods.
        method = super(XEditableMixin, self).get
        method = ensure_csrf_cookie(method)
        return method(request, *args, **kwargs)
예제 #14
0
 def as_view(cls, **kwargs):
     """
     Optionally decorates the base view function with
     django.views.decorators.csrf.ensure_csrf_cookie().
     
     """
     view = super(EnsureCsrfCookie, cls).as_view(**kwargs)
     return (
         csrf.ensure_csrf_cookie(view)
             if cls.ensure_csrf_cookie
             else view)
예제 #15
0
    def build_view(cls):
        '''Builds the view function for this publisher.'''
        def view(request, *args, **kwargs):
            '''A wrapper view to instantiate and dispatch'''
            self = cls(request, *args, **kwargs)
            return self.dispatch(request, **kwargs)

        if cls.CSRF:
            view = ensure_csrf_cookie(view)
        else:
            view = csrf_exempt(view)
        return view
예제 #16
0
    def _inner(*args, **kwargs):  # pylint: disable=missing-docstring
        if args:
            # Set the META `CROSS_DOMAIN_CSRF_COOKIE_USED` flag so
            # that `CsrfCrossDomainCookieMiddleware` knows to set
            # the cross-domain version of the CSRF cookie.
            request = args[0]
            request.META['CROSS_DOMAIN_CSRF_COOKIE_USED'] = True

        # Decorate the request with Django's
        # `ensure_csrf_cookie` to ensure that the usual
        # CSRF cookie gets set.
        return ensure_csrf_cookie(func)(*args, **kwargs)
예제 #17
0
    def _inner(*args, **kwargs):  # pylint: disable=missing-docstring
        if args:
            # Set the META `CROSS_DOMAIN_CSRF_COOKIE_USED` flag so
            # that `CsrfCrossDomainCookieMiddleware` knows to set
            # the cross-domain version of the CSRF cookie.
            request = args[0]
            request.META['CROSS_DOMAIN_CSRF_COOKIE_USED'] = True

        # Decorate the request with Django's
        # `ensure_csrf_cookie` to ensure that the usual
        # CSRF cookie gets set.
        return ensure_csrf_cookie(func)(*args, **kwargs)
예제 #18
0
    def build_view(cls):
        '''Builds the view function for this publisher.'''
        def view(request, *args, **kwargs):
            '''A wrapper view to instantiate and dispatch'''
            self = cls(request, *args, **kwargs)
            return self.dispatch(request, **kwargs)

        if cls.CSRF:
            view = ensure_csrf_cookie(view)
        else:
            view = csrf_exempt(view)
        return view
예제 #19
0
def topic_update(request, topic_id):
    response_data = {}
    if request.user.is_authenticated():
        response_data['auth'] = 1
    else:
        response_data['jauth'] = 0
    ensure_csrf_cookie(request)

    time = request.POST['now']
    try:
        time = datetime.fromtimestamp(int(time)/1e3)
        comment_list = Comment.objects.all().filter(parent_id=topic_id, date__gt=time)
        
        counter = 0
        
        for comment in comment_list:
            response_data[str(counter)] = {'content': comment.content, 'commentid': comment.id, 'vote':comment.vote}
            counter += 1
        print response_data
    except Exception as e:
        print e
    
    return HttpResponse(json.dumps(response_data), content_type="application/json")
예제 #20
0
    def as_view(cls, **kwargs):
        """
        Override Django's default as_view to apply view decorators as specified.
        """
        view = super(RemarkViewDecoratorsMixin, cls).as_view(**kwargs)

        if (view is not None) and cls.sensitive_post_parameters:
            if isinstance(cls.sensitive_post_parameters, list):
                view = sensitive_post_parameters(
                    *cls.sensitive_post_parameters)(view)
            else:
                view = sensitive_post_parameters()(view)

        if (view is not None) and cls.ensure_csrf_cookie:
            view = ensure_csrf_cookie(view)

        if (view is not None) and cls.csrf_exempt:
            view = csrf_exempt(view)

        return view
예제 #21
0
    def decorator(fn):
        @wraps(fn)
        def wrapper(request, *args, **kwargs):
            if request.method not in methods:
                return HttpResponseBadRequest(
                    'Method {} not supported.'.format(request.method))

            if login_required and not request.user.is_authenticated():
                return HttpResponseForbidden('Permission denied.')

            if request.body:
                try:
                    kwargs = dict(kwargs,
                                  jsondata=json.loads(
                                      request.body.decode('utf-8')))
                except ValueError:
                    return HttpResponseBadRequest(
                        'Invalid JSON in request body.')

            try:
                ret = fn(request, *args, **kwargs)
            except AjaxBadRequest as e:
                return HttpResponseBadRequest(str(e))
            except AjaxPermissionDenied as e:
                return HttpResponseForbidden(str(e) or 'Permission denied.')

            if isinstance(ret, HttpResponse):
                response = ret
            else:
                response = JsonResponse(data=ret, safe=False, encoder=encoder)

            if expires_in:
                response['Expires'] = http_date(time.time() + expires_in)
                response['Cache-Control'] = 'private, max-age={}'.format(
                    expires_in)

            return response

        return ensure_csrf_cookie(wrapper)
예제 #22
0
 def get_urls(self):
     return [
         path(
             "<pk>/send/",
             self.admin_site.admin_view(self.send_view),
             name="nuntius_campaign_send",
         ),
         path(
             "<pk>/pause/",
             self.admin_site.admin_view(self.pause_view),
             name="nuntius_campaign_pause",
         ),
         path(
             "<pk>/mosaico/",
             ensure_csrf_cookie(
                 self.admin_site.admin_view(self.mosaico_view)),
             name="nuntius_campaign_mosaico",
         ),
         path(
             "<pk>/mosaico/preview/",
             self.admin_site.admin_view(self.mosaico_preview),
             name="nuntius_campaign_mosaico_preview",
         ),
         path(
             "<pk>/mosaico/save/",
             self.admin_site.admin_view(self.mosaico_save_view),
             name="nuntius_campaign_mosaico_save",
         ),
         path(
             "<pk>/mosaico/data/",
             self.admin_site.admin_view(self.mosaico_load_view),
             name="nuntius_campaign_mosaico_load",
         ),
         path(
             "<pk>/mosaico/upload/",
             self.admin_site.admin_view(MosaicoImageUploadView.as_view()),
             name="nuntius_campaign_mosaico_image_upload",
         ),
     ] + super().get_urls()
예제 #23
0
class App(crapp.App):
    appurls = [
        crapp.Url(r'^$',
                  ExaminerFeedbackfeedRedirectView.as_view(),
                  name=crapp.INDEXVIEW_NAME),
        crapp.Url(r'^feedback$',
                  ensure_csrf_cookie(ExaminerFeedbackView.as_view()),
                  name='feedback'),
        crapp.Url(r'^public-discuss',
                  ExaminerPublicDiscussView.as_view(),
                  name='public-discuss'),
        crapp.Url(r'^examiner-admin-discuss',
                  ExaminerWithAdminsDiscussView.as_view(),
                  name='examiner-admin-discuss'),
        crapp.Url(r'^edit/(?P<pk>\d+)$',
                  ExaminerEditGradeView.as_view(),
                  name='edit'),
        crapp.Url(r'^groupcomment-delete/(?P<pk>\d+)$',
                  GroupCommentDeleteView.as_view(),
                  name="groupcomment-delete"),
        crapp.Url(r'^groupcomment-edit/(?P<pk>\d+)$',
                  GroupCommentEditView.as_view(),
                  name='groupcomment-edit'),
    ]
예제 #24
0
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from django.views.decorators.csrf import ensure_csrf_cookie
from .views import logout, user, auth, data_estimator, request_geonames

urlpatterns = [
    url(r'^login',
        ensure_csrf_cookie(
            TemplateView.as_view(template_name='ui/index.html')),
        name='login'),
    url(r'^auth/$', ensure_csrf_cookie(auth), name='auth'),
    url(r'^$',
        login_required(TemplateView.as_view(template_name='ui/index.html')),
        name="home"),
    url(r'^exports$',
        login_required(TemplateView.as_view(template_name='ui/index.html')),
        name="exports"),
    url(r'^create$',
        login_required(TemplateView.as_view(template_name='ui/index.html')),
        name="create"),
    url(r'^account',
        login_required(TemplateView.as_view(template_name='ui/index.html')),
        name="account"),
    url(r'^user$', login_required(user), name="user"),
    url(r'^logout', login_required(logout), name="logout"),
    url(r'^estimator$', login_required(data_estimator)),
    url(r'^request_geonames$', login_required(request_geonames)),
]
예제 #25
0
     'filterlist',
     views.JavascriptDemoView.as_view(
         template_name=
         'cradmin_javascript_demos/filterlist/filterlist-demo.django.html'),
     name="cradmin_javascript_demos_filterlist"),
 path(
     'filterlist-querystring',
     views.JavascriptDemoView.as_view(
         template_name=
         'cradmin_javascript_demos/filterlist/filterlist-querystring-demo.django.html'
     ),
     name="cradmin_javascript_demos_filterlist_querystring"),
 path('datalistwidgets',
      ensure_csrf_cookie(
          views.JavascriptDemoView.as_view(
              template_name=
              'cradmin_javascript_demos/data-list-widgets-demo.django.html')
      ),
      name="cradmin_javascript_demos_datalistwidgets"),
 path('datalistwidgets-uicontainer',
      views.DataListWidgetsUicontainerDemo.as_view(),
      name="cradmin_javascript_demos_datalistwidgets_uicontainer"),
 path('auto-submit-form-after-countdown',
      views.AutoSubmitFormAfterCountdownDemoView.as_view(),
      name="cradmin_auto_submit_form_after_countdown_demo"),
 path('api/move-fictional-figures',
      demo_api.FictionalFigureMoveView.as_view(),
      name='cradmin_move_fictional_figures_api'),
 path(
     'api/',
     include((apirouter.urls, 'cradmin_javascript_demos_api'),
예제 #26
0
파일: urls.py 프로젝트: kvimal13/billy
# speeches
urlpatterns += patterns(
    'billy.web.public.views.speeches',

    url(r'^(?P<abbr>[a-z-]+)/speeches/$', 'speeches',
        name='speeches'),
    url(r'^(?P<abbr>[a-z-]+)/speeches/(?P<event_id>[\w-]+)/',
        'speeches_by_event', name='speeches_by_event'),
)

# bills
urlpatterns += patterns(
    'billy.web.public.views.bills',

    url(r'^(?P<abbr>all)/bills/$', ensure_csrf_cookie(AllBillList.as_view()),
        name='all_bills'),
    url(r'^(?P<abbr>all)/bills-csv/$',
        ensure_csrf_cookie(AllBillCSVList.as_view()), name='all_bills_csv'),
    url(r'^(?P<abbr>[a-z-]+)/bills/$', ensure_csrf_cookie(BillList.as_view()),
        name='bills'),
    url(r'^(?P<abbr>[a-z-]+)/bills/feed/$', BillFeed.as_view(),
        name='bills_feed'),
    url(r'^(?P<abbr>[a-z-]+)/bills/(?P<session>[^/]+)/(?P<bill_id>[^/]+)/$',
        'bill', name='bill'),
    url(r'^(?P<abbr>[a-z-]+)/(?P<bill_id>[^/]+)/$',
        'bill_noslug', name='bill_noslug'),
    url(r'^(?P<abbr>[a-z-]+)/bills/(?P<session>[^/]+)/'
        r'(?P<bill_id>[^/]+)/(?P<key>documents)/$', 'all_documents',
        name='bill_all_documents'),
    url(r'^(?P<abbr>[a-z-]+)/bills/(?P<session>[^/]+)/'
예제 #27
0
from django.conf.urls import patterns, url, include
from django.contrib.auth.decorators import login_required
from django.views.i18n import javascript_catalog
from django.views.decorators.csrf import csrf_protect, ensure_csrf_cookie


from devilry_settings.i18n import get_javascript_catalog_packages
from .views import AppView
from .views import StatusPrintView


i18n_packages = get_javascript_catalog_packages('devilry_extjsextras', 'devilry_header', 'devilry.apps.core', 'devilry_subjectadmin', 'devilry_qualifiesforexam')



urlpatterns = patterns('devilry_qualifiesforexam',
    url('^rest/', include('devilry_qualifiesforexam.rest.urls')),
    url('^$', login_required(csrf_protect(ensure_csrf_cookie(AppView.as_view()))),
        name='devilry_qualifiesforexam_ui'),
    url('^statusprint/(?P<status_id>\d+)$', login_required(StatusPrintView.as_view()),
        name='devilry_qualifiesforexam_statusprint'),
    url('^i18n.js$', javascript_catalog, kwargs={'packages': i18n_packages},
        name='devilry_qualifiesforexam_i18n')
)

예제 #28
0
파일: urls.py 프로젝트: xiaomin0208/gkp
		# school
		url(r'^school/$', cache_page(60 * 15)(views.MySchoolList.as_view()), name='school_list'),
		url(r'^school/add/$', views.MySchoolAdd.as_view(), name='school_add'),
		url(r'^school/(?P<pk>\d+)/edit/$', views.MySchoolEdit.as_view(), name='school_edit'),
		url(r'^school/(?P<pk>\d+)/delete/$', views.MySchoolDelete.as_view(), name='school_delete'),
		url(r'^school/(?P<pk>\d+)/detail/$', views.MySchoolDetail.as_view(), name='school_detail'),
		url(r'^school/(?P<pk>\d+)/detail/major/$', cache_page(60 * 15)(views.MySchoolDetailMajor.as_view()), name='school_detail_major'),
		url(r'^school/(?P<pk>\d+)/detail/admission/$', cache_page(60 * 15)(views.MySchoolDetailAdmission.as_view()), name='school_detail_admission'),
		url(r'^school/(?P<pk>\d+)/detail/stream/$', views.MySchoolDetailStream.as_view(), name='school_detail_stream'),
		url(r'^school/(?P<pk>\d+)/detail/hd/$', views.MySchoolDetailHudong.as_view(), name='school_detail_hd'),
		url(r'^school/(?P<pk>\d+)/detail/plan/$', views.MySchoolDetailAdmissionPlan.as_view(), name='school_detail_admission_plan'),
		url(r'^school/detail/related/$', views.MySchoolDetailRelatedSchools.as_view(), name='school_detail_related_schools'),


		url(r'^school/map/filter/', ensure_csrf_cookie(views.MySchoolMapFilter.as_view()),name='school_map_filter'),
		url(r'^school/map/detail/', ensure_csrf_cookie(views.MySchoolMapDetail.as_view()),name='school_map_detail'),
		url(r'^school/map/info/', ensure_csrf_cookie(views.MySchoolMapInfo.as_view()),name='school_map_info'),
		url(r'^school/e/map/filter/$', views.MySchoolEchartMapFilter.as_view(),name='school_echart_map_filter'),
		url(r'^school/rank/(?P<rank>\d+)/$', cache_page(60 * 15)(views.MySchoolRank.as_view()), name='school_rank'),
		url(r'^school/majors/filter/tags/$', ensure_csrf_cookie(views.MySchoolMajorsFilterByTags.as_view()), name='school_majors_filter_by_tags'),
		url(r'^school/weixin/(?P<pk>\d+)/$', cache_page(60 * 15)(views.MySchoolWeixin.as_view()), name='school_weixin'),


		# analysis
		url(r'^analysis/school/summary/ajax/$', views.AnalysisSchoolSummaryAJAX.as_view(), name='analysis_school_summary_ajax'),
		url(r'^analysis/school/detail/ajax/$', views.AnalysisSchoolDetailAJAX.as_view(), name='analysis_school_detail_ajax'),		
		url(r'^analysis/school/province/(?P<pk>\d+)/$', views.AnalysisSchoolByProvince.as_view(), name='analysis_school_by_province'),
		url(r'^analysis/school/city/(?P<pk>\d+)/$', views.AnalysisSchoolByCity.as_view(), name='analysis_school_by_city'),
		url(r'^analysis/major/category/(?P<pk>\d+)/$', views.AnalysisMajorByCategory.as_view(), name='analysis_major_by_category'),			
		url(r'^analysis/major/subcategory/(?P<pk>\d+)/$', views.AnalysisMajorBySubcategory.as_view(), name='analysis_major_by_subcategory'),			
예제 #29
0
try:
    from django.conf.urls import patterns, url, include
except ImportError:
    from django.conf.urls.defaults import patterns, url, include
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import ensure_csrf_cookie
from survey.views import *

# pylint: disable-msg=C0103,E1120
dashboard_patterns = patterns(
    '',
    url(r'^$', login_required(ensure_csrf_cookie(IndexView.as_view())), name='index'),
    url(r'^new/$', login_required(ensure_csrf_cookie(SurveyNewView.as_view())), name='newsurvey'),
    url(r'^presets/$', login_required(ensure_csrf_cookie(PresetSearchView.as_view())), name='preset_search_view'),
    url(r'^archive/$', login_required(ensure_csrf_cookie(SurveyArchiveView.as_view())), name='surveyarchive'),
    url(r'^(?P<slug>[-_\w]+)/$', login_required(ensure_csrf_cookie(SurveyDashboardView.as_view())), name='surveydashboard'),
    url(r'^(?P<slug>[-_\w]+)/edit/$', login_required(ensure_csrf_cookie(SurveyEditView.as_view())), name='surveyedit'),
    url(r'^(?P<slug>[-_\w]+)/details/$', login_required(ensure_csrf_cookie(SurveyDetailsView.as_view())), name='surveydetails'),
    url(r'^(?P<slug>[-_\w]+)/delete/$', login_required(ensure_csrf_cookie(SurveyDeleteView.as_view())), name='surveydelete'),
    url(r'^(?P<slug>[-_\w]+)/clone/$', login_required(ensure_csrf_cookie(SurveyCloneView.as_view())), name='surveyclone'),
    url(r'^(?P<slug>[-_\w]+)/results/$', login_required(ensure_csrf_cookie(SurveyResultsView.as_view())), name='surveyresults'),
    url(r'^(?P<slug>[-_\w]+)/export/$', login_required(ensure_csrf_cookie(SurveyExportView.as_view())), name='exportresults'),
    url(r'^(?P<slug>[-_\w]+)/(?P<choice_id>\d+)/results/$', login_required(ensure_csrf_cookie(SurveyResultsView.as_view())), name='surveyresults'),
    url(r'^(?P<slug>[-_\w]+)/ballot/(?P<ballot_id>\d+)?$', login_required(ensure_csrf_cookie(BallotResultsView.as_view())), name='ballot'),
)

# pylint: disable-msg=C0103,E1120
urlpatterns = patterns(
    'survey.views',
    url(r'^dashboard/', include(dashboard_patterns)),
    url(r'^(?P<slug>[-_\w]+)/$', SurveyView.as_view(), name='survey'),
예제 #30
0
파일: urls.py 프로젝트: balalay12/cachalka
import views

from django.conf.urls import url
from django.views.decorators.csrf import ensure_csrf_cookie

urlpatterns = [
    url(r'^$', ensure_csrf_cookie(views.Main.as_view()), name='main'),
    url(r'^reg/$', views.Registration.as_view(), name='reg'),
    url(r'^login/$', views.LogIn.as_view(), name='login'),
    url(r'^logout/$', views.LogOut.as_view(), name='logout'),
    url(r'^api/exercises/$', views.Exercises.as_view(), name='exercises'),
    url(r'^api/sets/$', views.Sets.as_view(), name='sets'),
    url(r'^api/repeats/$', views.Repeats.as_view(), name='repeats'),
    url(r'^api/categories/$', views.Categories.as_view(), name='categories'),
    url(r'^api/addtraining/$', views.AddTraining.as_view(), name='add_training'),
    url(r'^api/profile/$', views.Profile.as_view(), name='profile'),
    url(r'^api/bodysize/$', views.BodySizeView.as_view(), name='body_size'),
    url(r'^api/check/$', views.CheckReg.as_view(), name='check'),
    url(r'^api/check/auth/$', views.CheckAuth.as_view(), name='auth')
]
예제 #31
0
파일: urls.py 프로젝트: amenasse/shoestring
from django.conf.urls import include, url
from django.shortcuts import render
from django.views.decorators.csrf import ensure_csrf_cookie

urlpatterns = [
    url(r'^$',
        ensure_csrf_cookie(render),
        {'template_name': 'shoestring/index.html'},
        name='index'),
    url(r'^cart/',
        include('shoestring.cart.urls', namespace='cart')),
    url(r'^accounts/',
        include('shoestring.accounts.urls', namespace='accounts')),
    url(r'^products/',
        include('shoestring.products.urls', namespace='products')),
    url(r'^order/',
        include('shoestring.orders.urls', namespace='orders')),
]
예제 #32
0
from django.conf.urls import patterns, url
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import TemplateView


urlpatterns = patterns(
    'proso_subscription.views',
    url(r'^(|home)$', ensure_csrf_cookie(TemplateView.as_view(template_name="subscription_home.html")), name='subscription_home'),
    url(r'^mysubscriptions/$', 'my_subscriptions', name='subscription_my_subscriptions'),
    url(r'^plans/$', 'plans', name='subscription_plans'),
    url(r'^myreferrals/$', 'my_referrals', name='subscription_my_referrals'),
    url(r'^subscribe/(?P<description_id>\d+)$', 'subscribe', name='subscription_subscribe'),
    url(r'^discount_code/(?P<code>\w+)$', 'discount_code_view', name='subscription_discount_code_view'),
    url(r'^revenue_per_month/(?P<currency>\w+)$', 'revenue_per_month', name='subscription_revenue_per_month'),
)
예제 #33
0
파일: urls.py 프로젝트: jkachika/columbus
"""
from django.views.decorators.csrf import ensure_csrf_cookie
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth.views import logout
from pyedf.views import *

admin.autodiscover()

urlpatterns = [
    url(r'^$', NLHome.as_view()),
    url(r'^login/$', Login.as_view()),
    url(r'^logout/$', logout, {'next_page': '/login'}),
    url(r'^verify$', verify),
    url(r'^test$', Test.as_view()),
    url(r'^home$', ensure_csrf_cookie(Home.as_view())),
    url(r'^workspace$', Workspace.as_view()),
    url(r'^history$', History.as_view()),
    url(r'^history/$', History.as_view()),
    url(r'^dashboard$', Dashboard.as_view()),
    url(r'^dashboard/$', Dashboard.as_view()),
    url(r'^import/$', Importer.as_view()),
    url(r'^controlpanel/$', ControlPanel.as_view()),
    url(r'^download/$', Download.as_view()),
    url(r'^delete/$', DeleteAsync.as_view()),
    url(r'^constraints$', WorkspaceAsync.as_view()),
    url(r'^elements/$', WorkspaceAsync.as_view()),
    url(r'^schedule$', WorkspaceAsync.as_view()),
    url(r'^startflow$', StartFlow.as_view()),
    url(r'^review$', WorkflowReview.as_view()),
    url(r'^generate$', WorkflowGenerator.as_view()),
예제 #34
0
from igg.marathon.views import *

from registration.views import activate
from registration.views import register

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
  # Admin
  url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
  url(r'^admin/', include(admin.site.urls)),

  url(r'^ajax/info/', AjaxMarathonInfoView.as_view(), name='ajax_marathon_info'),
  url(r'^ajax/(?P<model>\w+)/', ensure_csrf_cookie(AjaxLookaheadView.as_view()), name='ajax_lookahead'),

  # django-paypal
  (r'^paypal/ipn/', include('paypal.standard.ipn.urls')),

  # django-registration
  url(r'^activate/complete/$',
    TemplateView.as_view(template_name='registration/activation_complete.html'),
    name='registration_activation_complete'),
  # Activation keys get matched by \w+ instead of the more specific
  # [a-fA-F0-9]{40} because a bad activation key should still get to the view;
  # that way it can return a sensible "invalid key" message instead of a
  # confusing 404.
  url(r'^activate/(?P<activation_key>\w+)/$',
    activate,
    {'backend': 'igg.marathon.backends.IggRegistrationBackend'},
예제 #35
0
from django.conf.urls import url
from django.contrib import admin

from backend.views import *
from django.views.decorators.csrf import ensure_csrf_cookie

urlpatterns = [
    url(r'^1/searchdays$', ensure_csrf_cookie(SearchDays.as_view())),
    url(r'^1/newexpense$', ensure_csrf_cookie(NewExpense.as_view()))
]
예제 #36
0
파일: urls.py 프로젝트: vistacan/django-rt
from django.conf.urls import patterns, include, url
from views import MainView
from django.views.decorators.csrf import ensure_csrf_cookie


urlpatterns = patterns(
    '',
    url(r'.*', ensure_csrf_cookie(MainView.as_view()), name='main'),
)
예제 #37
0
    re_path(r'^oauth/', include(('api.oauth.urls', 'oauth'),
                                namespace='oauth')),
    re_path(r'^_admin/logout/$', LogoutView.as_view(), name='logout'),
    re_path(r'^_admin/login/$',
            RedirectView.as_view(url=conf.get(LOGIN_URL),
                                 permanent=True,
                                 query_string=True),
            name='login'),
    re_path(r'^_health/?$', HealthView.as_view(), name='health_check'),
    re_path(r'^_status/?$', StatusView.as_view(), name='status_check'),
    re_path(r'^{}/'.format(API_V1),
            include((api_patterns, 'v1'), namespace='v1')),
    re_path(r'^$', IndexView.as_view(), name='index'),
    re_path(r'^50x.html$', Handler50xView.as_view(), name='50x'),
    re_path(r'^app.*/?',
            login_required(ensure_csrf_cookie(ReactIndexView.as_view())),
            name='react-index'),
]


def _handler500(request):
    return Handler50xView.as_view()(request)


handler404 = Handler404View.as_view()
handler403 = Handler403View.as_view()
handler500 = _handler500

if conf.get(ADMIN_VIEW_ENABLED):
    urlpatterns += [re_path(r'^_admin/', admin.site.urls)]
예제 #38
0
def dashboard_page(request):
    ensure_csrf_cookie(request)
    logging.info("Page Changed: " + request.POST.get("page", None))
    if request.POST.get("page", None) == "user_center":
        return user_center(request)

    if request.POST.get("page", None) == "announcement":
        return page_announcement(request)

    if request.POST.get("page", None) == "news":
        return render(request, "dashboard/settings/account.html", {})

    if request.POST.get("page", None) == "papers":
        return page_papers(request)

    if request.POST.get("page", None) == "project_plan":
        return page_project_plan(request)

    if request.POST.get("page", None) == "community":
        return page_community(request)

    if request.POST.get("page", None) == "declaration_center":
        return page_declaration_center(request)

    if request.POST.get("page", None) == "declare_buildings":
        return page_declare_buildings(request)

    if request.POST.get("page", None) == "declare_animals":
        return page_declare_animals(request)

    if request.POST.get("page", None) == "police_hall":
        return page_police_hall(request)

    if request.POST.get("page", None) == "call_the_police":
        return page_call_the_police(request)

    if request.POST.get("page", None) == "world_map":
        return page_world_map(request)

    if request.POST.get("page", None) == "rookies":
        return page_rookies(request)

    if request.POST.get("page", None) == "settings":
        return page_settings(request)
    if request.POST.get("page", None) == "whitelist":
        return page_whitelist(request)
    if request.POST.get("page", None) == "system_menu":
        return system_menu(request)
    if request.POST.get("page", None) == "wenjuan":
        return page_wenjuan(request)
    if request.POST.get("page", None) == "skull":
        return page_skull(request)
    if request.POST.get("page", None) == "maps":
        return page_maps(request)
    if request.POST.get("page", None) == "logs":
        return page_logs(request)
    if request.POST.get("page", None) == "para":
        return page_para(request)
    if request.POST.get("page", None) == "society":
        return page_society(request)
    if request.POST.get("page", None) == "society_info":
        return society.society_info(request)
    if request.POST.get("page", None) == "task_list":
        return page_task_list(request)
    if request.POST.get("page", None) == "task":
        return page_task(request)
    if request.POST.get("page", None) == "user":
        return user.user_list(request)
    if request.POST.get("page", None) == "group":
        return user.group(request)
    if request.POST.get("page", None) == "permissions":
        return user.permissions(request)
    if request.POST.get("page", None) == "reward":
        return page_rawerd(request)
    if request.POST.get("page", None) == "signin":
        return page_signin(request)
    if request.POST.get("page", None) == "message":
        return page_message(request)
    if request.POST.get("page", None) == "ops_log":
        return page_ops_log(request)
    if request.POST.get("page", None) == "cms_book_list":
        return cms_book_ist(request)
    if request.POST.get("page", None) == "cms_chapter_list":
        return cms.chapter(request)
    if request.POST.get("page", None) == "ops_log_list":
        return ops.log_info(request)
    if request.POST.get("page", None) == "demand_list":
        return demand.index(request, "list")
    if request.POST.get("page", None) == "demand":
        return demand.index(request)
    if request.POST.get("page", None) == "test":
        return user.test(request)
    if request.POST.get("page", None) == "fish":
        return fish.fish_index(request)
    if request.POST.get("page", None) == "rarity":
        return fish.rarity(request)
    if request.POST.get("page", None) == "fish_pond":
        return fish.pond(request)
    if request.POST.get("page", None) == "fish_pool":
        return fish.pool(request)
    if request.POST.get("page", None) == "fish_match":
        return fish.match(request)
    if request.POST.get("page", None) == "mc_icon":
        return fish.icon(request)

    return HttpResponse("Response: " + request.POST.get("page", None))
예제 #39
0
live_document_router = routers.DefaultRouter()
live_document_router.register(r'sections',
                              document_views.LiveDocumentSectionViewSet)

api_urlpatterns = router.urls + \
    patterns('',
             url(r'^questions/question/(?P<question>\d+)/',
                 include(question_router.urls)),
             url(r'^processes/process/(?P<process>\d+)/',
                 include(process_router.urls)),
             url(r'^processes/process_instance/(?P<instance>\d+)/',
                 include(process_instance_router.urls)),
             url(r'^documents/live_document/(?P<live_document>\d+)/',
                 include(live_document_router.urls)),
             url(r'^accounts/organization/(?P<organization>\d+)/',
                 include(organization_router.urls)),
             url(r'^auth/', include('rest_framework.urls',
                                    namespace='rest_framework')))

app_view = TemplateView.as_view(template_name='app.html')
urlpatterns = patterns('',
                       url(r'^$', ensure_csrf_cookie(app_view), name='app'),
                       url(r'^api/', include(api_urlpatterns)),
                       url(r'^', include('apps.accounts.urls')),
                       url(r'^visual-admin/', include(admin.site.urls)))

#try:
#    exec('from visualorg.conf.environments.{}.urls import *'
#         .format(APP_ENVIRONMENT))
#except ImportError:
#    pass
예제 #40
0
 def as_view(cls, *args: Any, **kwargs: Any) -> View:
     view = super().as_view(*args, **kwargs)  # type: ignore
     return ensure_csrf_cookie(view)
예제 #41
0
from django.conf.urls import patterns, url
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import TemplateView
from .models import UserQuestion, UserQuestionPossibleAnswer


urlpatterns = patterns(
    'proso_user.views',
    url(r'^(|home)$', ensure_csrf_cookie(TemplateView.as_view(template_name="user_home.html")), name='home'),
    url(r'^login/', 'login', name='login'),
    url(r'^logout/', 'logout', name='logout'),
    url(r'^profile/', 'profile', name='profile'),
    url(r'^session/', 'session', name='session'),
    url(r'^signup/', 'signup', name='signup'),
    url(r'^ngservice/', 'user_service', name='user_service'),
    url(r'^ngservice_test/', TemplateView.as_view(template_name="user_service_test.html"), name='user_service_test'),
    url(r'^close_popup/', TemplateView.as_view(template_name="close_popup.html"), name='close_popup'),
    url(r'^initmobile/', 'initmobile_view', name='initmobile'),
    url(r'answer_question', 'answer_question', name='answer_question'),
    url(r'^questions_to_ask', 'questions_to_ask', name='user_questions_to_ask'),
    url(r'^questions/', 'show_more', {'object_class': UserQuestion}, name='show_user_questions'),
    url(r'^question/(?P<id>\d+)', 'show_one', {'object_class': UserQuestion}, name='show_user_question'),
    url(r'^possible_answers/', 'show_more', {'object_class': UserQuestionPossibleAnswer}, name='show_user_question_possible_answers'),
    url(r'^possible_answer/(?P<id>\d+)', 'show_one', {'object_class': UserQuestionPossibleAnswer}, name='show_user_question_possible_answer'),
)
예제 #42
0
from django.conf.urls import patterns, url
from .models import Experiment, PossibleValue, Variable, ExperimentSetup
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import TemplateView


urlpatterns = patterns(
    'proso_configab.views',
    url(r'^(|home)$', ensure_csrf_cookie(TemplateView.as_view(template_name="configab_home.html")), name='proso_configab_home'),
    url(r'^experiments$', 'show_more', {'object_class': Experiment}, name='show_configab_experiments'),
    url(r'^experiment/(?P<id>\d+)', 'show_one', {'object_class': Experiment}, name='show_configab_experiment'),
    url(r'^experimentsetup/(?P<id>\d+)', 'show_one', {'object_class': ExperimentSetup}, name='show_configab_experiment_setup'),
    url(r'^value/(?P<id>\d+)', 'show_one', {'object_class': PossibleValue}, name='show_configab_possible_value'),
    url(r'^variable/(?P<id>\d+)', 'show_one', {'object_class': Variable}, name='show_configab_variable'),
)
예제 #43
0
파일: urls.py 프로젝트: maremaremare/biblio
def yandex(request):
    return HttpResponse('500b3fb7d9ea')


urlpatterns = patterns('',
                       # url(r'^payment?ik_co_id=(?P<ik_co_id>\S+)&ik_inv_id=(?P<ik_inv_id>\S+)&ik_inv_st=(?P<ik_inv_st>\S+)&ik_inv_crt=(?P<ik_inv_crt>\S+)&ik_inv_prc=(?P<ik_inv_prc>\S+)&ik_pm_no=(?P<ik_pm_no>\S+)&ik_pw_via=(?P<ik_pw_via>\S+)&ik_am=(?P<ik_am>\S+)&ik_cur=(?P<ik_cur>\S+)&ik_co_rfn=(?P<ik_co_rfn>\S+)&ik_ps_price=(?P<ik_ps_price>\S+)&ik_desc=(?P<ik_desc>\S+)$)',
                       url(r'^$',
                           HomePageView.as_view()),
                       url(r'^shop/tags/(?P<slug>\w+)$',
                           TagView.as_view(), name='tags'),
                       url(r'^shop/books/(?P<slug>\w+)/buy/$',
                           BuyView.as_view(), name='buy'),
                       url(r'^shop/books/(?P<slug>\w+)$',
                           BookView.as_view(), name='book'),
                       url(r'^shop$', ensure_csrf_cookie(BookList.as_view(template_name='shoplist.html')),
                           name='shop'),

                       url(r'^shop/(?P<author_slug>\w+)$',
                           AuthorBookList.as_view(
                               template_name='shoplist.html'), name='shop-author'),
                       url(r'^shop/(?P<author_slug>[\w-]+)/(?P<category_slug>[\w-]+)$',
                           AuthorBookList.as_view(
                               template_name='shoplist.html'), name='shop-author-category'),
                       url(r'^pages/(?P<slug>\w+)$',
                           PageView.as_view(template_name='page.html')),
                       url(r'^payment$', PaymentView.as_view()),
                       url(r'^payment/(?P<encrypted_id>\S+)$',
                           PaymentView.as_view()),
                       url(r'^download/(?P<encrypted_id>\S+)/$',
                           Download_file.as_view()),
예제 #44
0
from django.views.decorators.csrf import csrf_protect, ensure_csrf_cookie
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from extjs4.views import Extjs4AppView


class AppView(Extjs4AppView):
    template_name = "devilry_frontpage/app.django.html"
    appname = "devilry_frontpage"
    css_staticpath = "devilry_theme/resources/stylesheets/devilry.css"
    title = _("Devilry - Frontpage")


frontpage = login_required(csrf_protect(ensure_csrf_cookie(AppView.as_view())))
예제 #45
0
from eventkit_cloud.ui.views import (
    logout,
    auth,
    geocode,
    get_config,
    convert_to_geojson,
    user_active,
    reverse_geocode,
    convert,
    search,
)

urlpatterns = [
    re_path(
        r"^login", never_cache(ensure_csrf_cookie(TemplateView.as_view(template_name="ui/index.html"))), name="login"
    ),
    re_path(r"^$", never_cache(login_required(TemplateView.as_view(template_name="ui/index.html"))), name="home"),
    re_path(
        r"^dashboard",
        never_cache(login_required(TemplateView.as_view(template_name="ui/index.html"))),
        name="dashboard",
    ),
    re_path(
        r"^exports/?$", never_cache(login_required(TemplateView.as_view(template_name="ui/index.html"))), name="exports"
    ),
    re_path(
        r"^status", never_cache(login_required(TemplateView.as_view(template_name="ui/index.html"))), name="status"
    ),
    re_path(
        r"^create/?$", never_cache(login_required(TemplateView.as_view(template_name="ui/index.html"))), name="create"
예제 #46
0
from django.conf.urls import patterns, url
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import TemplateView

urlpatterns = patterns('ui.views',
   url('^$', ensure_csrf_cookie(TemplateView.as_view(template_name='ui/index.html')), name='index'),
)
예제 #47
0
from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt
from navigation.views import HomeNavigationView
from catalog.views import CategoryListView, CategoryDetailView, ProductDetailView, ProductReviewView
from content.views import NewsListView, NewsDetailView, StaticPageView
from shop.views import LoginView, LogoutView, CartView, CustomerView,\
    OrderView, OrderListView , OrderDetailView, OrderLiqPayConfirmView, OrderInvoice
from search.views import SearchView

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', HomeNavigationView.as_view(), name='home'),

    url(r'^catalog/$', CategoryListView.as_view(), name='category_list'),
    url(r'^catalog/(?P<slug>[-\w]+)/$', CategoryDetailView.as_view(), name='category_detail'),
    url(r'^catalog/(?P<category_slug>[-\w]+)/(?P<slug>[-\w]+)/$', ensure_csrf_cookie(ProductDetailView.as_view()), name='product_detail'),
    url(r'^catalog/(?P<category_slug>[-\w]+)/(?P<slug>[-\w]+)/review/$', ensure_csrf_cookie(ProductReviewView.as_view()), name='product_review'),

    url(r'^news/$', NewsListView.as_view(), name='news_list'),
    url(r'^news/(?P<pk>[\d]+)/$', NewsDetailView.as_view(), name='news_detail'),

    url(r'^shop/login/$', LoginView.as_view(), name='shop_login'),
    url(r'^shop/logout/$', LogoutView.as_view(), name='shop_logout'),
    url(r'^shop/cart/$', CartView.as_view(), name='shop_cart'),
    url(r'^shop/customer/$', CustomerView.as_view(), {}, name='shop_customer'),
    url(r'^shop/order/$', OrderView.as_view(), name='shop_order'),
    url(r'^shop/orders/$', OrderListView.as_view(), name='shop_order_list'),
    url(r'^shop/order/(?P<pk>[\d]+)/$', OrderDetailView.as_view(), name='shop_order_detail'),
    url(r'^shop/order/(?P<pk>[\d]+)/liqpay-confirm/$', csrf_exempt(OrderLiqPayConfirmView.as_view()), name='shop_order_liqpay_confirm'),
    url(r'^shop/order/(?P<pk>[\d]+)/invoice\.pdf$', OrderInvoice.as_view(), name='shop_order_invoice'),
예제 #48
0
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from django.views.decorators.csrf import ensure_csrf_cookie

from .views import logout, data_estimator, auth, geocode, get_config, convert_to_geojson, user_active, reverse_geocode, convert
from django.views.decorators.cache import never_cache

urlpatterns = [
    url(r'^login',
        never_cache(
            ensure_csrf_cookie(
                TemplateView.as_view(template_name='ui/index.html'))),
        name='login'),
    url(r'^/?$',
        never_cache(
            login_required(
                TemplateView.as_view(template_name='ui/index.html'))),
        name="home"),
    url(r'^exports/?$',
        never_cache(
            login_required(
                TemplateView.as_view(template_name='ui/index.html'))),
        name="exports"),
    url(r'^status',
        never_cache(
            login_required(
                TemplateView.as_view(template_name='ui/index.html'))),
        name="status"),
예제 #49
0
"""djangular 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.conf.urls import include, url
from django.views.generic import TemplateView
from django.views.decorators.csrf import ensure_csrf_cookie
urlpatterns = [
    url(r'^$',
        ensure_csrf_cookie(TemplateView.as_view(template_name='index.html'))),
    url('^admin/', admin.site.urls),
    url('^scrumboard/', include('scrumboard.urls')),
    url(r'^auth_api/', include('auth_api.urls')),
]
예제 #50
0
파일: urls.py 프로젝트: csmatt/socialocale
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

from django.conf.urls import *
from django.views.decorators.csrf import ensure_csrf_cookie
from SociaLocale.apps.main.views import Root, LandingPage
urlpatterns = patterns('',
    url(r'^interests/', include('SociaLocale.apps.interests.urls')),
    url(r'^user/', include('SociaLocale.apps.sl_user.urls')),
    url(r'^accounts/', include('userena.urls')),
    url(r'^messages/', include('SociaLocale.apps.messages.urls')),
    url('^landing', ensure_csrf_cookie(LandingPage.as_view())),
    url('^$', ensure_csrf_cookie(Root.as_view())),
    url('^subscribe/', LandingPage.as_view()),
    url(r'', include('social_auth.urls')),

    #Route('/privacy', handler='controllers.handlers.PrivacyPolicyHandler'),
    #Route('/og/interest', OpenGraphHandler),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
)
from settings import common
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
# Add media and static files
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(common.MEDIA_URL, document_root=common.MEDIA_ROOT)
예제 #51
0
파일: urls.py 프로젝트: tomka/CATMAID
from catmaid.history import record_request_action as record_view


# A regular expression matching floating point and integer numbers
num = r'[-+]?[0-9]*\.?[0-9]+'
integer = r'[-+]?[0-9]+'
# A regular expression matching lists of integers with comma as delimiter
intlist = r'[0-9]+(,[0-9]+)*'
# A list of words, not containing commas
wordlist= r'\w+(,\w+)*'

app_name = 'catmaid'

# Add the main index.html page at the root:
urlpatterns = [
    url(r'^$', ensure_csrf_cookie(CatmaidView.as_view(template_name='catmaid/index.html')), name="home"),
    url(r'^version$', common.get_catmaid_version)
]

# Authentication and permissions
urlpatterns += [
    url(r'^accounts/login$', authentication.login_user),
    url(r'^accounts/logout$', authentication.logout_user),
    url(r'^accounts/(?P<project_id>\d+)/all-usernames$', authentication.all_usernames),
    url(r'^permissions$', authentication.user_project_permissions),
    url(r'^classinstance/(?P<ci_id>\d+)/permissions$', authentication.get_object_permissions),
    url(r'^register$', authentication.register),
]

# Users
urlpatterns += [
예제 #52
0
# -*- coding: utf-8 -*-
from django.urls import include, re_path
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import TemplateView

from eventkit_cloud.ui.views import logout, auth, geocode, get_config, convert_to_geojson, user_active, \
    reverse_geocode, \
    convert, search

urlpatterns = [
    re_path(r'^login', never_cache(ensure_csrf_cookie(TemplateView.as_view(template_name='ui/index.html'))), name='login'),
    re_path(r'^$', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="home"),
    re_path(r'^dashboard', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="dashboard"),
    re_path(r'^exports/?$', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="exports"),
    re_path(r'^status', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="status"),
    re_path(r'^create/?$', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="create"),
    re_path(r'^account', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="account"),
    re_path(r'^about', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="about"),
    re_path(r'^groups', never_cache(login_required(TemplateView.as_view(template_name='ui/index.html'))), name="groups"),
    re_path(r'^logout', never_cache(login_required(logout)), name="logout"),
    re_path(r'^search/?$', never_cache(login_required(search))),
    re_path(r'^geocode/?$', never_cache(login_required(geocode))),
    re_path(r'^convert/?$', login_required(convert)),
    re_path(r'^reverse_geocode/?$', login_required(reverse_geocode)),
    re_path(r'^configuration/?$', never_cache(get_config)),
    re_path(r'^file_upload/?$', never_cache(login_required(convert_to_geojson))),
    re_path(r'^user_active$', never_cache(login_required(user_active)), name='user_active'),
]
예제 #53
0
if settings.DEBUG:
    urlpatterns += [
        url(r'^editing_data$', views.editing_data),
    ]

if settings.DEBUG or settings.BTW_TESTING:
    from django.views.decorators.csrf import ensure_csrf_cookie
    urlpatterns += [
        url(
            r'^sf_editor_test/$',
            never_cache(
                login_required(
                    ensure_csrf_cookie(
                        ContextTemplateView.as_view(
                            template_name="lexicography/sf_editor_test.html",
                            context={
                                'semantic_field_fetch_url':
                                reverse_lazy(
                                    "semantic_fields_semanticfield-list"),
                            }))))),
    ]

# These are views used only in testing.
if settings.BTW_TESTING:
    urlpatterns += [
        url(r'^handle/(?P<handle_or_entry_id>.+)/mod$',
            views.handle_background_mod,
            name='lexicography_handle_background_mod'),
        url(r'^entry/(?P<lemma>.+)/testing-mark-valid$',
            views.entry_testing_mark_valid,
            name='lexicography_entry_testing_mark_valid')
    ]
예제 #54
0
 def as_view(cls, **initkwargs):
     view = super(PostDetailView, cls).as_view(**initkwargs)
     return ensure_csrf_cookie(view)
예제 #55
0
파일: urls.py 프로젝트: Robbie1977/CATMAID
from catmaid.history import record_request_action as record_view

# A regular expression matching floating point and integer numbers
num = r'[-+]?[0-9]*\.?[0-9]+'
integer = r'[-+]?[0-9]+'
# A regular expression matching lists of integers with comma as delimiter
intlist = r'[0-9]+(,[0-9]+)*'
# A list of words, not containing commas
wordlist = r'\w+(,\w+)*'

app_name = 'catmaid'

# Add the main index.html page at the root:
urlpatterns = [
    url(r'^$',
        ensure_csrf_cookie(
            CatmaidView.as_view(template_name='catmaid/index.html')),
        name="home"),
    url(r'^version$', common.get_catmaid_version)
]

# Authentication and permissions
urlpatterns += [
    url(r'^accounts/login$', authentication.login_user),
    url(r'^accounts/logout$', authentication.logout_user),
    url(r'^accounts/(?P<project_id>\d+)/all-usernames$',
        authentication.all_usernames),
    url(r'^permissions$', authentication.user_project_permissions),
    url(r'^classinstance/(?P<ci_id>\d+)/permissions$',
        authentication.get_object_permissions),
    url(r'^register$', authentication.register),
]
예제 #56
0
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.csrf import csrf_exempt
from django.conf.urls import url

from tagsiyacht import settings
from yachts import views

urlpatterns = [
    url(r'^rest/login/$', views.login_view),
    url(r'^rest/logout/$', views.logout_view),
    url(r'^rest/signup/$', views.signup_view),

    url(r'^rest/yachts/$', ensure_csrf_cookie(views.YachtList.as_view())),
    url(r'^rest/yachts/(?P<pk>[0-9]+)/$', views.YachtDetail.as_view()),
    url(r'^rest/yachts/(?P<pk>[0-9]+)/buy/$', views.buy_yacht_view),
    url(r'^rest/clients/$', csrf_exempt(views.ClientList.as_view())),
    url(r'^rest/clients/(?P<pk>[0-9]+)/$', views.ClientDetail.as_view()),
    url(r'^rest/yachts/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),
]
예제 #57
0
"""djangular URL Configuration

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.views.generic import TemplateView
from django.views.decorators.csrf import ensure_csrf_cookie

urlpatterns = [
    path('admin/', admin.site.urls),
    path('scrumboard/', include('scrumboard.urls')),
    path('',
         ensure_csrf_cookie(TemplateView.as_view(template_name="home.html"))),
    path('auth_api/', include('auth_api.urls'))
]
예제 #58
0
# -*- coding: utf-8 -*-

from django.urls import re_path
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import ensure_csrf_cookie

from eventkit_cloud.auth.views import callback, logout, oauth

urlpatterns = [
    re_path(r"^oauth$", ensure_csrf_cookie(oauth), name="oauth"),
    re_path(r"^callback$", ensure_csrf_cookie(callback), name="callback"),
    re_path(r"^logout$",
            never_cache(ensure_csrf_cookie(logout)),
            name="logout"),
]
예제 #59
0
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.core.urlresolvers import reverse_lazy
from django.views.generic import RedirectView
from django.views.decorators.csrf import ensure_csrf_cookie

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()


urlpatterns = patterns('',
   # Examples:

    url(r'^$', RedirectView.as_view(url=reverse_lazy('dockerfile'))),

    url(r'^dockerfile/$', ensure_csrf_cookie(TemplateView.as_view(template_name='dockerfile/introduction.html')), name='dockerfile'),
    url(r'^dockerfile/level1/$', ensure_csrf_cookie(TemplateView.as_view(template_name='dockerfile/level1.html')), name='dockerfile_level1'),

)


예제 #60
0
 def get(self, request, *args, **kwargs):
     view = ensure_csrf_cookie(DatasetDisplay.as_view())
     return view(request, *args, **kwargs)