Esempio n. 1
0
]

partial_edit_patterns = [
    url(r'ideat/(?P<initiative_id>\d+)/muokkaa/%s/$' % u[0],
        legacy_json_plaintext((u[3] if len(u) > 3 else views.IdeaPartialEditView).
                              as_view()),
        name='edit_idea_%s' % u[1],
        kwargs={'template_name': 'content/idea_edit_%s_form.html' % u[1],
                'form_class': u[2], 'fragment': u[1]}
    ) for u in IDEA_FRAGMENT_URLS
]

urlpatterns = patterns('',
    url(r'selaa/$', views.IdeaListView.as_view(), name='initiative_list'),
    url(r'^rss/$', views.IdeaFeed(), name='rss'),
    url(r'ideat/uusi/$', check_perm(IsAuthenticated)(views.CreateIdeaView.as_view()),
        name='create_idea'),
    url(r'ideat/muunna-kysymys-ideaksi/(?P<question_id>\d+)/$',
        check_perm(IsAuthenticated)(views.QuestionToIdea.as_view()),
        name='question_to_idea'),
    url(r'ideat/(?P<initiative_id>\d+)/julkaise/$',
        initiative_as_obj(check_perm(CanPublishIdea)(
            views.PublishIdeaView.as_view()
        )),
        name='publish_idea'),
    url(r'ideat/(?P<initiative_id>\d+)/julkaise-idea-ja-kyselyt/$',
        initiative_as_obj(check_perm(CanPublishIdea)(
            views.PublishIdeaAndSurveysView.as_view()
        )),
        name='publish_idea_and_surveys'),
    url(r'idean-kysely/(?P<survey_id>\d+)/kysely/muokkaa/nimi/$',
Esempio n. 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(
Esempio n. 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
Esempio n. 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()),
Esempio n. 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(
Esempio n. 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
Esempio n. 7
0
from content.models import Initiative

from . import views
from .models import Gallup
from .perms import CanAnswerGallup, CanViewGallup, CanCreateGallup, CanDeleteGallup, \
    CanEditGallup, CanOpenGallup, CanCloseGallup


gallup_as_obj = obj_by_pk(Gallup, "gallup_id")
initiative_as_obj = obj_by_pk(Initiative, "initiative_id")

urlpatterns = patterns(
    "",
    url(
        r'^uusi/$',
        initiative_as_obj(check_perm(CanCreateGallup)(views.GallupFormView.as_view())),
        name='create'
    ),
    url(
        r'^(?P<gallup_id>\d+)/muokkaa/$',
        gallup_as_obj(check_perm(CanEditGallup)(views.GallupFormView.as_view())),
        name='edit'
    ),
    url(
        r'^(?P<gallup_id>\d+)/avaa/$',
        gallup_as_obj(check_perm(CanOpenGallup)(
            views.GallupStatusChangeView.as_view(status=Gallup.STATUS_OPEN)
        )),
        name='open'
    ),
    url(
Esempio n. 8
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"
Esempio n. 9
0
    ) for u in ORGANIZATION_FRAGMENT_URLS
]

partial_edit_patterns = [
    url(r'(?P<pk>\d+)/muokkaa/%s/$' % u[0],
        legacy_json_plaintext(views.OrganizationPartialEditView.as_view()),
        name='edit_organization_%s' % u[1],
        kwargs={'template_name': 'organization/organization_edit_%s_form.html' % u[1],
                'form_class': u[2], 'fragment': u[1]}
    ) for u in ORGANIZATION_FRAGMENT_URLS
]

urlpatterns = patterns(
    '',
    url(r'^$', views.OrganizationListView.as_view(), name='list'),
    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)),
Esempio n. 10
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'),
Esempio n. 11
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'))
Esempio n. 12
0
from __future__ import unicode_literals

from django.conf.urls import url

from libs.djcontrib.conf.urls import decorated_patterns
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(
Esempio n. 13
0
    url(r'(?P<pk>\d+)/muokkaa/%s/$' % u[0],
        legacy_json_plaintext(views.OrganizationPartialEditView.as_view()),
        name='edit_organization_%s' % u[1],
        kwargs={
            'template_name':
            'organization/organization_edit_%s_form.html' % u[1],
            'form_class': u[2],
            'fragment': u[1]
        }) for u in ORGANIZATION_FRAGMENT_URLS
]

urlpatterns = patterns(
    '',
    url(r'^$', views.OrganizationListView.as_view(), name='list'),
    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'),
Esempio n. 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'),
)
Esempio n. 15
0
from content.models import Initiative

from . import views
from .models import Gallup
from .perms import CanAnswerGallup, CanViewGallup, CanCreateGallup, CanDeleteGallup, \
    CanEditGallup, CanOpenGallup, CanCloseGallup

gallup_as_obj = obj_by_pk(Gallup, "gallup_id")
initiative_as_obj = obj_by_pk(Initiative, "initiative_id")

urlpatterns = patterns(
    "",
    url(r'^uusi/$',
        initiative_as_obj(
            check_perm(CanCreateGallup)(views.GallupFormView.as_view())),
        name='create'),
    url(r'^(?P<gallup_id>\d+)/muokkaa/$',
        gallup_as_obj(
            check_perm(CanEditGallup)(views.GallupFormView.as_view())),
        name='edit'),
    url(r'^(?P<gallup_id>\d+)/avaa/$',
        gallup_as_obj(
            check_perm(CanOpenGallup)(views.GallupStatusChangeView.as_view(
                status=Gallup.STATUS_OPEN))),
        name='open'),
    url(r'^(?P<gallup_id>\d+)/vastaa/$',
        gallup_as_obj(
            check_perm(CanAnswerGallup)(views.GallupResultsView.as_view())),
        name='answer'),
    url(r'^(?P<gallup_id>\d+)/tulokset/$',
Esempio n. 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
Esempio n. 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')
)