예제 #1
0
    def test_create_user(self):
        view = CreateUserView()
        view.request = 'request'

        form = self.moxx.CreateMock(UsernameCreationForm)
        form.save().AndReturn('user')
        self.moxx.StubOutWithMock(utils, 'authenticate_without_password')
        utils.authenticate_without_password('user').AndReturn('user')
        self.moxx.StubOutWithMock(auth, 'login')
        auth.login('request', 'user')

        self.moxx.ReplayAll()
        view.form_valid(form)
        self.moxx.VerifyAll()
예제 #2
0
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.base import TemplateView

from accounts.views import CreateUserView, EditUserView, LoginUserView

urlpatterns = patterns('',
    url(r'^login/$', LoginUserView.as_view(), name='login'),
    url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/login'}, name='logout'),

    url(r'^signup/$', CreateUserView.as_view(), name='signup'),
    url(r'^profile/$', TemplateView.as_view(template_name='accounts/profile.html'), name='profile'),
    url(r'^profile/edit/$', EditUserView.as_view(), name='edit'),
    url(r'^profile/edit/password/$', 'django.contrib.auth.views.password_change', {'template_name': 'generic/form.html', 'post_change_redirect': '/profile'}, name='password_change'),
)
예제 #3
0
from django.conf.urls import patterns, url
from accounts.views   import CreateUserView


urlpatterns = patterns("",
  url(r"^login/$", "django.contrib.auth.views.login", {"template_name": "templates/login.html"}),
  url(r"^logout/$", "django.contrib.auth.views.logout_then_login"),
  url(r"^create/$", CreateUserView.as_view()),
)
예제 #4
0
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.base import TemplateView

from accounts.views import CreateUserView, EditUserView, LoginUserView

urlpatterns = patterns(
    '',
    url(r'^login/$', LoginUserView.as_view(), name='login'),
    url(r'^logout/$',
        'django.contrib.auth.views.logout', {'next_page': '/login'},
        name='logout'),
    url(r'^signup/$', CreateUserView.as_view(), name='signup'),
    url(r'^profile/$',
        TemplateView.as_view(template_name='accounts/profile.html'),
        name='profile'),
    url(r'^profile/edit/$', EditUserView.as_view(), name='edit'),
    url(r'^profile/edit/password/$',
        'django.contrib.auth.views.password_change', {
            'template_name': 'generic/form.html',
            'post_change_redirect': '/profile'
        },
        name='password_change'),
)
예제 #5
0
from django.urls import path
from accounts.views import CreateUserView

app_name = 'accounts'

urlpatterns = [
    path('create/', CreateUserView.as_view(), name='create'),
]
예제 #6
0
"""BookShop URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.urls import path, include

from accounts.views import UpdateUserView, CreateUserView, UserProfileView, ChangePasswordView

urlpatterns = [
    path("", include("django.contrib.auth.urls")),
    path("user/<int:pk>", UpdateUserView.as_view(), name='userchange'),
    path("userprofile/<int:pk>", UserProfileView.as_view(), name="userprofile"),
    path("changepassword/", ChangePasswordView.as_view(), name="changepassword"),
    path("registration/", CreateUserView.as_view(), name="registration"),

]