Пример #1
0
        name='idea_survey_name'),
    url(r'ideat/(?P<initiative_id>\d+)/kysely/uusi/$', initiative_as_obj(
        check_perm(CanCreateSurvey)(views.CreateSurvey.as_view())), name='create_survey'),
    url(r'idean-kysely/(?P<survey_id>\d+)/avaa/$', survey_as_obj(
        check_perm(CanOpenSurvey)(views.IdeaSurveyStatusChangeView.as_view(
            status=IdeaSurvey.STATUS_OPEN))), name='survey_open'),
    url(r'idean-kysely/(?P<survey_id>\d+)/sulje/$', survey_as_obj(
        check_perm(CanCloseSurvey)(views.IdeaSurveyStatusChangeView.as_view(
            status=IdeaSurvey.STATUS_CLOSED))), name='survey_close'),
    url(r'idean-kysely/(?P<survey_id>\d+)/poista/$', survey_as_obj(
        check_perm(CanDeleteSurvey)(views.DeleteIdeaSurveyView.as_view())),
        name='survey_delete'),
    url(r'idean-kysely/(?P<survey_id>\d+)/tulokset-pdf/$', survey_as_obj(
        check_perm(ShowSurveyResults)(views.SurveyResultsToPdfView.as_view())),
        name='survey_results'),
) + decorated_patterns('', combo(initiative_as_obj, check_perm(CanVoteIdea)),
     url(r'ideat/(?P<initiative_id>\d+)/kannata/$',
         views.IdeaVoteView.as_view(choice=Vote.VOTE_UP),
         name='support_idea'),
     url(r'ideat/(?P<initiative_id>\d+)/vastusta/$',
         views.IdeaVoteView.as_view(choice=Vote.VOTE_DOWN),
         name='oppose_idea'),
) + decorated_patterns('', initiative_as_obj,
    url(r'kysymykset/(?P<initiative_id>\d+)/$', views.QuestionDetailView.as_view(),
        name='question_detail'),
    url(r'kysymykset/(?P<initiative_id>\d+)/kommentointi/$',
        nkcomments.CommentBlockView.as_view(model=Question,
                                 pk_url_kwarg='initiative_id'),
        name='comment_block_question'),
) + decorated_patterns('', combo(initiative_as_obj, check_perm(CanViewIdea)),
    url(r'ideat/(?P<initiative_id>\d+)/$', views.IdeaDetailView.as_view(),
Пример #2
0
from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo, obj_by_generic_pk, obj_by_pk
from libs.moderation.models import ModeratedObject
from libs.permitter.decorators import check_perm

from nkmoderation.perms import CanFlagObject, CanModerateContent, CanModerateObject

from . import views

moderated_obj_by_pk = obj_by_pk(ModeratedObject,
                                url_kwarg='moderated_object_id')

urlpatterns = decorated_patterns(
    '',
    combo(obj_by_generic_pk(), check_perm(CanFlagObject)),
    url(r'^ilmoita-asiaton-sisalto/(?P<content_type_id>\d+)/(?P<object_id>\d+)/$',
        views.FlagContentView.as_view(),
        name='flag_content'),
) + decorated_patterns(
    '', combo(moderated_obj_by_pk, check_perm(CanModerateObject)),
    url(r'^moderointi/(?P<moderated_object_id>\d+)/hyvaksy/$',
        views.ApproveModeratedObject.as_view(),
        name='approve_object'),
    url(r'^moderointi/(?P<moderated_object_id>\d+)/poista/$',
        views.RejectModeratedObject.as_view(),
        name='reject_object'),
    url(r'^moderointi/(?P<moderated_object_id>\d+)/poista/$',
        views.RejectModeratedObject.as_view(),
        name='reject_object')
) + decorated_patterns(
Пример #3
0
    url(r'^hallinta/', include('nkadmin.urls', namespace='nkadmin')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('content.urls', namespace='content')),
    url(r'^organisaatiot/', include('organization.urls', namespace='organization')),
    url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog'),
    url(r'^kommentit/', include('nkcomments.urls', namespace='nkcomments')),
    url(r'', include('social.apps.django_app.urls', namespace='social')),
    url(r'^palaute/$', FeedbackView.as_view(), name="feedback"),
    url(r'', include('nkmoderation.urls', namespace='nkmoderation')),
    url(r'^tietoa-palvelusta/', include('help.urls', namespace='help')),
    url(r'^tiedotteet/', include('info.urls', namespace='info')),
    url(r'^kampanjat/', include('campaign.urls', namespace='campaign')),
    url(r'^suosikit/', include('favorite.urls', namespace='favorite')),
    url(r'^widget/', xframe_options_exempt(ShowWidgetView.as_view()), name="nkwidget"),
    url(r'^', include('survey.urls', namespace='survey')),
    url('^liitteet/laheta/(?P<upload_group_id>[a-f0-9]{32})'
        '(?P<upload_token>[a-f0-9]{32})/$',
        combo(check_perm(IsAuthenticated), legacy_json_plaintext)(
            UploadAttachmentView.as_view()
        ),
        name='attachtor_file_upload'),
    url('^liitteet/sallitut-paatteet/$', AllowedFileUploadExtensions.as_view(),
        name='allowed_file_upload_extensions')
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


if settings.STATIC_URL.startswith('http'):
    urlpatterns += staticfiles_urlpatterns('/static/')

handler404 = views.error_page_not_found
Пример #4
0
                'account/user_reset_password_link_sent.html'}),
    url(r'^nollaa-salasana/vahvista/(?P<uidb64>[0-9A-Za-z_\-]+)'
         '/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
        auth.password_reset_confirm,
        name='password_reset_confirm',
        kwargs={
            'template_name': 'account/user_reset_password_confirm.html',
            'post_reset_redirect': 'account:password_reset_ready'
        }),
    url(r'^nollaa-salasana/valmis/$',
        FlashRedirectView.as_view(
            message=_("Salasanasi on vaihdettu. Voit nyt kirjautua sisään "
                      "käyttäen uutta salasanaasi."),
            pattern_name='account:login'
        ), name='password_reset_ready')
) + decorated_patterns('', combo(obj_by_pk(User, 'user_id'), check_perm(CanViewUser)),
    url(r'^(?P<user_id>\d+)/$',
        obj_by_pk(User, 'user_id')(views.UserProfileView.as_view()), name='profile'),
) + decorated_patterns('', combo(obj_by_pk(User, 'user_id'), check_perm(CanEditUser)),
    url(r'(?P<user_id>\d+)/asetukset/$', views.UserSettingsView.as_view(),
        name='settings'),
    url(r'(?P<user_id>\d+)/nayta-asetukset/',
        views.UserSettingsDetailView.as_view(),
        name='settings_detail'),
    url(r'(?P<user_id>\d+)/muokkaa-asetukset/',
        views.UserSettingsEditView.as_view(),
        name='settings_edit'),
    url(r'(?P<user_id>\d+)/asetukset/kuva/$', views.ProfilePictureView.as_view(),
        name='profile_picture'),
    url(r'(?P<user_id>\d+)/asetukset/kuva/muokkaa/$',
        legacy_json_plaintext(views.EditProfilePictureView.as_view()),
Пример #5
0
from django.conf.urls import patterns, url, include

from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo, obj_by_pk
from libs.permitter.decorators import check_perm

from . import views
from .models import Survey, SurveyQuestion
from .perms import CanEditSurvey, CanAnswerSurvey, ShowSurveyResults

survey_as_obj = obj_by_pk(Survey, "survey_id")
question_as_obj = obj_by_pk(SurveyQuestion, "question_id")

urlpatterns = decorated_patterns(
    "",
    combo(survey_as_obj, check_perm(CanEditSurvey)),
    url(
        r"^kysely/(?P<survey_id>\d+)/",
        include(
            patterns(
                "",
                url(
                    r"^elementti/(?P<element_id>\d+)/",
                    include(patterns(
                        "",
                        url(r"^nosta/$",
                            views.SurveyElementMoveView.as_view(
                                direction="up"),
                            name="move_up"),
                        url(r"^laske/$",
                            views.SurveyElementMoveView.as_view(
Пример #6
0
from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo, obj_by_pk
from libs.permitter.decorators import check_perm
from nkcomments.perms import CanEditComment

from nkvote.models import Vote

from . import views
from .models import CustomComment
from .perms import CanVoteComment, CanDeleteComment

urlpatterns = patterns(
    'django_comments.views',
    url(r'^(?P<initiative_id>\d+)/post/$',
        combo(obj_by_pk(Initiative, "initiative_id"),
              check_perm(CanCommentInitiative))(views.post_comment),
        name='post-comment'),
)

# Votes
urlpatterns += decorated_patterns(
    "",
    combo(obj_by_pk(CustomComment, "comment_id"), check_perm(CanVoteComment)),
    url(r'^(?P<comment_id>\d+)/kannata/$',
        views.VoteCommentView.as_view(choice=Vote.VOTE_UP),
        name="support_comment"),
    url(r'^(?P<comment_id>\d+)/vastusta/$',
        views.VoteCommentView.as_view(choice=Vote.VOTE_DOWN),
        name="oppose_comment"))

# Comment deletion/edit
Пример #7
0
# coding=utf-8

from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView

from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo
from openapi.decorators import swagger_content_type_hack, swagger_api_description_hack

from .routers import router


urlpatterns = patterns('',
    url('^$', RedirectView.as_view(url='/api/open/%s/' % settings.OPEN_API['version'],
                                   permanent=False), name='root'),
    url('^0.1/', include(router.urls))
) + decorated_patterns('', combo(swagger_content_type_hack, swagger_api_description_hack),
    url(r'^docs/', include('rest_framework_swagger.urls'))
)
Пример #8
0
# coding=utf-8

from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView

from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo
from openapi.decorators import swagger_content_type_hack, swagger_api_description_hack

from .routers import router

urlpatterns = patterns(
    '',
    url('^$',
        RedirectView.as_view(
            url='/api/open/%s/' % settings.OPEN_API['version'],
            permanent=False),
        name='root'), url('^0.1/', include(router.urls))) + decorated_patterns(
            '', combo(swagger_content_type_hack, swagger_api_description_hack),
            url(r'^docs/', include('rest_framework_swagger.urls')))
Пример #9
0
# coding=utf-8

from __future__ import unicode_literals

from django.conf.urls import patterns, url
from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo, obj_by_generic_pk
from libs.permitter.decorators import check_perm
from libs.djcontrib.utils.decorators import obj_by_pk

from . import views
from nuka.perms import IsAuthenticated
from account.perms import CanEditUser
from account.models import User

urlpatterns = decorated_patterns(
    '',
    combo(obj_by_generic_pk(), check_perm(IsAuthenticated)),
    url(r'^seuraa/(?P<content_type_id>\d+)/(?P<object_id>\d+)/$',
        views.AddOrRemoveIdeaView.as_view(),
        name='add_or_remove_idea'),
) + decorated_patterns(
    '', combo(obj_by_pk(User, 'user_id'), check_perm(CanEditUser)),
    url(r'^(?P<user_id>\d+)/seuratut/muokkaa/(?P<ct_id>\d+)/$',
        views.UserFavoriteEditView.as_view(),
        name='favorite_edit'),
    url(r'^(?P<user_id>\d+)/seuratut/nayta/(?P<ct_id>\d+)/$',
        views.UserFavoriteDetailView.as_view(),
        name='favorite_detail'))
Пример #10
0
    url(r'uusi/$', check_perm(IsAuthenticated)(views.CreateOrganizationView.as_view()),
        name='create'),
    url(r'^(?P<pk>\d+)/arkistoi/',
        org_by_pk(check_perm(IsModerator)(views.OrganizationArchiveView.as_view())),
        name='archive'),
    url(r'^(?P<pk>\d+)/piilota/',
        org_by_pk(
            check_perm(IsModerator)(views.OrganizationSetActiveView.as_view(active=False))
        ),
        name='deactivate'),
    url(r'^(?P<pk>\d+)/aktivoi/',
        org_by_pk(
            check_perm(IsModerator)(views.OrganizationSetActiveView.as_view(active=True))
        ),
        name='activate'),
) + decorated_patterns('', combo(org_by_pk, check_perm(CanViewOrganization)),
    url(r'^(?P<pk>\d+)/$', SlugRedirect.as_view(model=Organization, permanent=False),
        name='detail_pk'),
    url(r'^(?P<pk>\d+)/lista/$', views.OrganizationIdeaList.as_view(), name='idea_list'),
    *partial_detail_urls
) + decorated_patterns('', combo(obj_by_slug, check_perm(CanViewOrganization)),
    url(r'^(?P<slug>[\w-]+)/$', views.OrganizationDetailView.as_view(), name='detail'),
) + decorated_patterns('', combo(org_by_pk, check_perm(CanEditOrganization)),
    url(r'^(?P<pk>\d+)/kuva/$', views.PictureView.as_view(),
        name='picture'),
    url(r'^(?P<pk>\d+)/kuva/muokkaa/$',
        legacy_json_plaintext(views.EditPictureView.as_view()),
        name='edit_picture'),
    url(r'^(?P<pk>\d+)/kuva/rajaa/$',
        views.CropProfilePictureView.as_view(), name='crop_picture'),
    url(r'^(?P<pk>\d+)/kuva/poista/$',
Пример #11
0
from libs.djcontrib.utils.decorators import combo
from libs.permitter.decorators import check_perm
from libs.djcontrib.utils.decorators import obj_by_pk

from account.models import User

from . import views
from .perms import CanAccessAdminPanel, CanEditUser


urlpatterns = decorated_patterns('', check_perm(CanAccessAdminPanel),
    url(r'^moderointi/$', views.ModerationQueueView.as_view(), name='moderation_queue'),
    url(r'^organisaatiot/$', views.ModerationOrganizationQueueView.as_view(), name='moderation_organization_queue'),
    url(r'^kayttajat/$', views.UsersView.as_view(), name='users'),
    url(r'^kayttajat/(?P<filter>\w+)/$', views.UsersView.as_view(), name='users'),
)

urlpatterns += decorated_patterns(
    '',
    combo(obj_by_pk(User), check_perm(CanEditUser)),
    url(
        r'^kayttajat/(?P<pk>\d+)/muokkaa/$',
        views.EditUserView.as_view(),
        name='users_edit'
    ),
    url(
        r'^kayttajat/(?P<pk>\d+)/vaihda_salasana/$',
        views.SetPasswordView.as_view(),
        name='change_password'
    )
)
Пример #12
0
    url(r'^(?P<pk>\d+)/arkistoi/',
        org_by_pk(
            check_perm(IsModerator)(views.OrganizationArchiveView.as_view())),
        name='archive'),
    url(r'^(?P<pk>\d+)/piilota/',
        org_by_pk(
            check_perm(IsModerator)(
                views.OrganizationSetActiveView.as_view(active=False))),
        name='deactivate'),
    url(r'^(?P<pk>\d+)/aktivoi/',
        org_by_pk(
            check_perm(IsModerator)(
                views.OrganizationSetActiveView.as_view(active=True))),
        name='activate'),
) + decorated_patterns(
    '', combo(org_by_pk, check_perm(CanViewOrganization)),
    url(r'^(?P<pk>\d+)/$',
        SlugRedirect.as_view(model=Organization, permanent=False),
        name='detail_pk'),
    url(r'^(?P<pk>\d+)/lista/$',
        views.OrganizationIdeaList.as_view(),
        name='idea_list'), *partial_detail_urls) + decorated_patterns(
            '',
            combo(obj_by_slug, check_perm(CanViewOrganization)),
            url(r'^(?P<slug>[\w-]+)/$',
                views.OrganizationDetailView.as_view(),
                name='detail'),
        ) + decorated_patterns(
            '', combo(org_by_pk, check_perm(CanEditOrganization)),
            url(r'^(?P<pk>\d+)/kuva/$',
                views.PictureView.as_view(),
Пример #13
0
from content.perms import CanCommentInitiative

from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo, obj_by_pk
from libs.permitter.decorators import check_perm
from nkcomments.perms import CanEditComment

from nkvote.models import Vote

from . import views
from .models import CustomComment
from .perms import CanVoteComment, CanDeleteComment


urlpatterns = patterns('django_comments.views',
    url(r'^(?P<initiative_id>\d+)/post/$', combo(obj_by_pk(Initiative, "initiative_id"),
                          check_perm(CanCommentInitiative))(views.post_comment), name='post-comment'),
)

# Votes
urlpatterns += decorated_patterns(
    "",
    combo(obj_by_pk(CustomComment, "comment_id"), check_perm(CanVoteComment)),
    url(
        r'^(?P<comment_id>\d+)/kannata/$',
        views.VoteCommentView.as_view(choice=Vote.VOTE_UP),
        name="support_comment"
    ),
    url(
        r'^(?P<comment_id>\d+)/vastusta/$',
        views.VoteCommentView.as_view(choice=Vote.VOTE_DOWN),
        name="oppose_comment"
Пример #14
0
from django.conf.urls import patterns, url

from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo, obj_by_generic_pk, obj_by_pk
from libs.moderation.models import ModeratedObject
from libs.permitter.decorators import check_perm

from nkmoderation.perms import CanFlagObject, CanModerateContent, CanModerateObject

from . import views


moderated_obj_by_pk = obj_by_pk(ModeratedObject, url_kwarg='moderated_object_id')

urlpatterns = decorated_patterns('', combo(obj_by_generic_pk(),
                                           check_perm(CanFlagObject)),
    url(r'^ilmoita-asiaton-sisalto/(?P<content_type_id>\d+)/(?P<object_id>\d+)/$',
        views.FlagContentView.as_view(), name='flag_content'),
) + decorated_patterns('', combo(moderated_obj_by_pk, check_perm(CanModerateObject)),
    url(r'^moderointi/(?P<moderated_object_id>\d+)/hyvaksy/$',
        views.ApproveModeratedObject.as_view(), name='approve_object'),
    url(r'^moderointi/(?P<moderated_object_id>\d+)/poista/$',
        views.RejectModeratedObject.as_view(), name='reject_object'),
    url(r'^moderointi/(?P<moderated_object_id>\d+)/poista/$',
        views.RejectModeratedObject.as_view(), name='reject_object')
) + decorated_patterns('', check_perm(CanModerateContent),
    url(r'^moderointi/(?P<content_type_id>\d+)/(?P<object_id>\d+)/syy/$',
        views.ApproveModeratedObject.as_view(), name='approve_object'),
)
Пример #15
0
     r'^nollaa-salasana/vahvista/(?P<uidb64>[0-9A-Za-z_\-]+)'
     '/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
     auth.password_reset_confirm,
     name='password_reset_confirm',
     kwargs={
         'template_name': 'account/user_reset_password_confirm.html',
         'post_reset_redirect': 'account:password_reset_ready'
     }),
 url(r'^nollaa-salasana/valmis/$',
     FlashRedirectView.as_view(message=_(
         "Salasanasi on vaihdettu. Voit nyt kirjautua sisään "
         "käyttäen uutta salasanaasi."),
                               pattern_name='account:login'),
     name='password_reset_ready')) + decorated_patterns(
         '',
         combo(obj_by_pk(User, 'user_id'), check_perm(CanViewUser)),
         url(r'^(?P<user_id>\d+)/$',
             obj_by_pk(User, 'user_id')(views.UserProfileView.as_view()),
             name='profile'),
     ) + decorated_patterns(
         '',
         combo(obj_by_pk(User, 'user_id'), check_perm(CanEditUser)),
         url(r'(?P<user_id>\d+)/asetukset/$',
             views.UserSettingsView.as_view(),
             name='settings'),
         url(r'(?P<user_id>\d+)/nayta-asetukset/',
             views.UserSettingsDetailView.as_view(),
             name='settings_detail'),
         url(r'(?P<user_id>\d+)/muokkaa-asetukset/',
             views.UserSettingsEditView.as_view(),
             name='settings_edit'),
Пример #16
0
    url(r'^organisaatiot/',
        include('organization.urls', namespace='organization')),
    url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog'),
    url(r'^kommentit/', include('nkcomments.urls', namespace='nkcomments')),
    url(r'', include('social.apps.django_app.urls', namespace='social')),
    url(r'^palaute/$', FeedbackView.as_view(), name="feedback"),
    url(r'', include('nkmoderation.urls', namespace='nkmoderation')),
    url(r'^tietoa-palvelusta/', include('help.urls', namespace='help')),
    url(r'^tiedotteet/', include('info.urls', namespace='info')),
    url(r'^kampanjat/', include('campaign.urls', namespace='campaign')),
    url(r'^suosikit/', include('favorite.urls', namespace='favorite')),
    url(r'^widget/',
        xframe_options_exempt(ShowWidgetView.as_view()),
        name="nkwidget"),
    url(r'^', include('survey.urls', namespace='survey')),
    url(
        '^liitteet/laheta/(?P<upload_group_id>[a-f0-9]{32})'
        '(?P<upload_token>[a-f0-9]{32})/$',
        combo(check_perm(IsAuthenticated), legacy_json_plaintext)(
            UploadAttachmentView.as_view()),
        name='attachtor_file_upload'),
    url('^liitteet/sallitut-paatteet/$',
        AllowedFileUploadExtensions.as_view(),
        name='allowed_file_upload_extensions')) + static(
            settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.STATIC_URL.startswith('http'):
    urlpatterns += staticfiles_urlpatterns('/static/')

handler404 = views.error_page_not_found
Пример #17
0
# coding=utf-8

from __future__ import unicode_literals

from django.conf.urls import patterns, url
from libs.djcontrib.conf.urls import decorated_patterns
from libs.djcontrib.utils.decorators import combo, obj_by_generic_pk
from libs.permitter.decorators import check_perm
from libs.djcontrib.utils.decorators import obj_by_pk

from . import views
from nuka.perms import IsAuthenticated
from account.perms import CanEditUser
from account.models import User

urlpatterns = decorated_patterns('', combo(obj_by_generic_pk(),
                                           check_perm(IsAuthenticated)),
    url(r'^seuraa/(?P<content_type_id>\d+)/(?P<object_id>\d+)/$',
        views.AddOrRemoveIdeaView.as_view(), name='add_or_remove_idea'),
) + decorated_patterns('', combo(obj_by_pk(User, 'user_id'), check_perm(CanEditUser)),
    url(r'^(?P<user_id>\d+)/seuratut/muokkaa/(?P<ct_id>\d+)/$',
        views.UserFavoriteEditView.as_view(),
        name='favorite_edit'),
    url(r'^(?P<user_id>\d+)/seuratut/nayta/(?P<ct_id>\d+)/$',
        views.UserFavoriteDetailView.as_view(),
        name='favorite_detail')
)