예제 #1
0
    def test_get_context_with_no_notify_in_session(self, super_mock):
        super_mock.return_value = dict(super=sentinel.super)

        view = UserSettingsView()
        view.request = Mock(session=dict())

        # When getting the context data
        context = view.get_context_data()

        # Then notify is not in the context
        assert 'notify' not in context
        assert context['super'] == sentinel.super
예제 #2
0
    def test_get_context_with_notify_in_session(self, super_mock):
        super_mock.return_value = {}
        # Given a request session with a notify value
        view = UserSettingsView()
        view.request = Mock(session=dict(notify=sentinel.notify))

        # When getting the context data
        context = view.get_context_data()

        # Then the notify value is included in the context
        assert context['notify'] == sentinel.notify

        # and the notify value is removed from the session
        assert 'notify' not in view.request.session
예제 #3
0
파일: urls.py 프로젝트: neerbee/neerbee
from tastypie.api import Api

from neerbee.api import *
from users.views import UserHomeView, UserSettingsView
from spots.views import SpotLikenessView, SpotTraitView

v1_api = Api(api_name="v1")
v1_api.register(SpotResource())
v1_api.register(ServiceResource())
v1_api.register(ServiceFoodResource())
v1_api.register(ServiceBarResource())
v1_api.register(ServiceCoffeeResource())
v1_api.register(ServiceClubResource())

urlpatterns = patterns(
    "",
    url(regex=r"^$", view=UserHomeView.as_view(), name="user_home"),
    url(r"^accounts/", include("accounts.urls")),
    url(r"^accounts/", include("registration.urls")),
    url(r"^admin/", include("admin.urls", namespace="admin")),
    url(regex=r"^api/v1/spot/(?P<spot_slug>\S+)/likeness/", view=SpotLikenessView.as_view(), name="spot_likeness"),
    url(regex=r"^api/v1/spot/(?P<spot_slug>\S+)/trait/", view=SpotTraitView.as_view(), name="spot_trait"),
    url(r"^api/", include(v1_api.urls)),
    url(regex=r"^settings/", view=UserSettingsView.as_view(), name="user_settings"),
    url(r"^spots/", include("spots.urls", namespace="spots")),
)

urlpatterns += patterns(
    "", (r"^static/(?P<path>.*)$", "django.views.static.serve", {"document_root": settings.STATIC_ROOT})
)
예제 #4
0
      name='password-reset'),
 path('password-reset/done/',
      PasswordResetDoneView.as_view(
          template_name='users/reset_password_done.html'),
      name='password_reset_done'),
 path('password-reset/confirm/<uidb64>/<token>/',
      PasswordResetConfirmView.as_view(
          template_name='users/reset_password_confirm.html'),
      name='password_reset_confirm'),
 path('password-reset/complete/',
      PasswordResetCompleteView.as_view(
          template_name='users/reset_password_complete.html'),
      name='password_reset_complete'),
 path('profile/<slug:username>', ProfileView.as_view(), name='profile'),
 path('settings/profile',
      UserSettingsView.as_view(),
      name='settings-profile'),
 path('match/create/', CreateMatchView.as_view(), name='match-creation'),
 path('match/update/<int:pk>',
      UpdateMatchView.as_view(),
      name='match-update'),
 path('match/list/planned',
      MatchPlannedListView.as_view(),
      name='match-planned'),
 path('match/list/over', MatchOverListView.as_view(), name='match-over'),
 path('match/list/in-progress',
      MatchInProgressListView.as_view(),
      name='match-in-progress'),
 path('match/subscription/list/planned',
      MatchSubscriptionPlannedListView.as_view(),
      name='match-subscription-planned'),
예제 #5
0
    # Checkout CRUD
    path('checkouts/', include([
        path('', CheckoutListView.as_view(), name='checkout_list'),
        path('create/', CheckoutCreateView.as_view(), name='checkout_create'),
        path('<int:pk>/', CheckoutReadView.as_view(), name='checkout_read'),
        path('<int:pk>/open/', CheckoutOpenView.as_view(), name='checkout_open'),
        path('<int:pk>/save/', CheckoutSaveView.as_view(), name='checkout_save'),
        path('<int:pk>/close/', CheckoutCloseView.as_view(), name='checkout_close')
    ])),
    # Shortcut to `checkout_create`
    path('open/', CheckoutCreateView.as_view(), name='checkout_create_shortcut'),

    # User sign in, settings etc
    path('beta/', BetaTokenView.as_view(), name='user_beta'),
    path('me/', UserSettingsView.as_view(), name='user_settings'),
    path('me/signup/', UserSignupView.as_view(), name='user_signup'),
    path('me/signin/', UserSigninView.as_view(), name='user_signin'),
    path('me/signout/', UserSignoutView.as_view(), name='user_signout'),
    path('me/username/', UsernameChangeView.as_view(), name='user_change_username'),
    path('me/avatar/', include('avatar.urls')),
    path('me/', include('allauth.urls')),

    # Staff admin
    path('admin/', admin.site.urls),

    # Home page
    path('', HomeView.as_view(), name='home'),

    # About pages etc
    path('about/', AboutView.as_view(), name='about'),
예제 #6
0
# coding=utf-8
from django.conf.urls import include, url
from users import views
from users.views import UserSettingsView

urlpatterns = [
    url(
        r'^profile/(?P<user_id>\d+)/$',
        views.UserProfileView.as_view(),
        name='user_profile'
    ),
    url(
        r'^settings/$',
        UserSettingsView.as_view(),
        name='user_settings'
    ),
    url(
        r'^friends/', include([
            url(
                r'^$',
                views.UserFriendsView.as_view(),
                name='user_friends'
            ),
            url(
                r'^incoming/$',
                views.UserIncomingView.as_view(),
                name='user_incoming'
            ),
            url(
                r'^outcoming/$',
                views.UserOutcomingView.as_view(),
예제 #7
0
from tofro.lib import login_required
from users.views import UserSettingsView


urlpatterns = [
    path('', homepage, name="home"),
    re_path(r'static-path/(?P<path>.+)', resolve_static_path_view),
    path('admin/', admin.site.urls, name="admin"),
    # Take over the password reset confirmation with our own view
    path('accounts/reset/<uidb64>/<token>/',
         PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
    path('accounts/', include('django.contrib.auth.urls')),
    path('actions/', decorator_include(login_required, ('actions.urls', 'actions'))),
    path('accounts/login', LoginView.as_view(), name="login"),
    path('accounts/logout', LogoutView.as_view(), name="logout"),
    path('accounts/settings', UserSettingsView.as_view(), name='user-settings'),
    path('notifications/', include('notifications.urls')),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + [
    re_path(r'^(?P<url>.*/)$', flatpage, name="page"),
]


# Add the debug toolbar.
if settings.DEBUG:
    import debug_toolbar
    urlpatterns = urlpatterns + [
        path('__debug__/', include(debug_toolbar.urls))
    ]

# Add Redis URLs.
urlpatterns += [