示例#1
0
def test_user_register_view_without_email(rf, user_data):
    data = {
        'email': 'nomail',
        'first_name': user_data.get('first_name'),
        'last_name': user_data.get('last_name'),
        'password': user_data.get('password')
    }

    request = rf.post(
        '/register/', json.dumps(data), content_type='application/json'
    )

    response = UserRegisterView.as_view()(request)
    assert response.status_code == BAD_REQUEST
示例#2
0
from django.conf import settings
from django.conf.urls.static import static
from hashtags.views import HashTagView
from accounts.views import UserRegisterView
from tweets.api.views import SearchTweetAPIView
from hashtags.api.views import TagTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TweetListView.as_view(), name='home'),
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'),
    url(r'^api/tags/(?P<hashtag>.*)/$',
        TagTweetAPIView.as_view(),
        name='tag-tweet-api'),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'),
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^register/$', UserRegisterView.as_view(), name='register'),
    url(r'^accounts/', include('accounts.passwords.urls')),
    url(r'^api/', include('accounts.api.urls', namespace='profiles-api')),
    url(r'^', include('accounts.urls', namespace='profiles')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
示例#3
0
文件: urls.py 项目: MdStart/Tweetme
from django.contrib import admin

from django.conf import settings
from django.conf.urls.static import static

from accounts.views import UserRegisterView

from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r'^admin/', admin.site.urls), #admin/
    url(r'^$', TweetListView.as_view(), name='home'), #/
    url(r'^search/$', SearchView.as_view(), name='search'), #/
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^api/tags/(?P<hashtag>.*)/$', TagTweetAPIView.as_view(), name='tag-tweet-api'), 
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'), 
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    url(r'^api/', include('accounts.api.urls', namespace='profiles-api')),
    url(r'^register/$', UserRegisterView.as_view(), name='register'), #/
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^', include('accounts.urls', namespace='profiles')),
]


if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
    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 accounts.views import UserRegisterView

from django.conf.urls.static import static
from django.conf import settings

from tweets import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('tweets/', include('tweets.urls')),
    path('', include('django.contrib.auth.urls')),
    path('accounts/', include('accounts.urls', namespace='accounts')),
    path('api/tweets/', include('tweets.api.urls')),
    path('api/', include('accounts.api.urls')),
    path('tags/', include('hashtags.urls')),
    path('register/', UserRegisterView.as_view(), name='register'),
    path('', views.TweetListView.as_view(), name='home'),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
示例#5
0
from django.conf import settings
from django.conf.urls.static import static

from accounts.views import UserRegisterView
from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    path('', TweetListView.as_view(), name="home"),
    path('search/', SearchView.as_view(), name="search"),
    path('admin/', admin.site.urls),
    path('api/tweet/', include('tweets.api.urls')),
    path('api/tags/<slug:hashtag>/',
         TagTweetAPIView.as_view(),
         name="tag-tweet-api"),
    path('api/search/', SearchTweetAPIView.as_view(), name="search-api"),
    path('api/', include('accounts.api.urls')),
    path('tags/<slug:hashtag>/', HashTagView.as_view(), name="hashtag"),
    path('tweet/', include('tweets.urls')),
    path('register/', UserRegisterView.as_view(), name="register"),
    path('', include('django.contrib.auth.urls')),
    path('', include('accounts.urls')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
示例#6
0
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static

from .views import home
from accounts.views import UserRegisterView
from tweet.views import home_tweet, tweet_detail_view, tweet_list_view, TweetListView, TweetDetailView
from tweet.views import TweetCreateView, TweetUpdateView, TweetDeleteView
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    # url(r'^$', home, name='home'),
    url(r'^tweet/$', home_tweet, name='home_tweet'),
    url(r'^tweet/detail$', tweet_detail_view, name='tweet_detail'),
    url(r'^tweet/list$', tweet_list_view, name='tweetlist'),
    url(r'^tweet/create$', TweetCreateView.as_view(), name='tweet_create'),
    url(r'^tweet/detail/(?P<pk>\d+)/edit/$',
        TweetUpdateView.as_view(),
        name='tweet_edit'),
    url(r'^tweet/detail/(?P<pk>\d+)/delete/$',
        TweetDeleteView.as_view(),
        name='tweet_delete'),
    url(r'^tweet/detail/(?P<id>\d+)/$',
        TweetDetailView.as_view(),
        name='tweet_detail'),
    url(r'^accounts/profile/$', TweetListView.as_view(), name='tweet_list'),
    url(r'^api/tweet/', include('tweet.api.urls', namespace='tweet-api')),
    url(r'^accounts/register/$', UserRegisterView.as_view(), name='register'),
    url(r'^', include('django.contrib.auth.urls')),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#7
0
from accounts.views import UserRegisterView

from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweets.views import TweetListView
from tweets.api.views import SearchTweetAPIView
from .views import home, SearchView
#from .views import home

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TweetListView.as_view(), name="home"),
    url(r'^search/$', SearchView.as_view(), name="search"),
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name="hashtag"),
    url(r'^api/tag/(?P<hashtag>.*)/$',
        TagTweetAPIView.as_view(),
        name="tag-tweet-api"),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name="search-api"),
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    url(r'^api/', include('accounts.api.urls', namespace='profiles-api')),
    url(r'^register/$', UserRegisterView.as_view(), name="register"),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^', include('accounts.urls', namespace='profiles')),
]

if settings.DEBUG:
    #urlpatterns += ((static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
示例#8
0
"""
from django.conf.urls import url, include
from django.contrib import admin

from accounts.views import UserRegisterView
from app import views
from app.views import usuarioDetailView
from app.views import actualizar, agregar_info, usuarioslista

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', views.home, name='home'),
    url(r'^nosotros/', views.info, name='nosotros'),
    url(r'^app/', views.appinfo, name='appinfo'),
    url(r'^perfil/', views.userpag, name='perfil'),
    url(r'^usuario/(?P<pk>\d+)/$', usuarioDetailView.as_view(),
        name='usuario'),
    url(r'^usuario/(?P<slug>[\w-]+)/$',
        usuarioDetailView.as_view(),
        name='usuario_slug'),
    url(r'^registrar/$', UserRegisterView.as_view(), name='Registro'),
    url('^', include('django.contrib.auth.urls')),
    url(r'^detalle/(?P<object_id>\d+)/$', views.detalle, name='detalle'),
    ############
    url(r'^usuario/(?P<pk>\d+)/editar/$',
        actualizar.as_view(),
        name='actualizar'),
    url(r'^crear/$', agregar_info.as_view(), name='crearinfo'),
    url(r'^usuarios/$', usuarioslista.as_view(), name='List_view'),
]
示例#9
0
from accounts.views import UserRegisterView

from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TweetListView.as_view(), name="home"),  # /
    url(r'^search/$', SearchView.as_view(), name="search"),  # /search/    
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name="hashtag"),
    url(r'^tweet/', include('tweets.urls', namespace="tweet")),
    url(r'^api/tags/(?P<hashtag>.*)/$',
        TagTweetAPIView.as_view(),
        name="tag-tweet-api"),
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name="search-api"),
    url(r'^api/tweet/', include('tweets.api.urls', namespace="tweet-api")),
    url(r'^api/', include('accounts.api.urls', namespace="profiles-api")),
    url(r'^register/$', UserRegisterView.as_view(),
        name="register"),  # /register/   
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^', include('accounts.urls', namespace="profiles")),
    #   url(r'^profiles/', include('accounts.urls', namespace="profiles")),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
示例#10
0
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import verify_jwt_token

from accounts import views
from accounts.views import UserInfoView, UserLoginView, UserRegisterView, UserActivateView, TokenRefreshView

router = DefaultRouter()
router.register('config', views.ConfigViewSet, basename='config')

urlpatterns = [
    path('users/me/', UserInfoView.as_view()),
    path('users/login/', UserLoginView.as_view()),
    path('users/register', UserRegisterView.as_view()),
    path('users/activate', UserActivateView.as_view()),
    path('token/refresh/', TokenRefreshView.as_view()),
    path('token/verify/', verify_jwt_token),
    path('', include(router.urls)),
]
示例#11
0
from django.conf import settings
from django.conf.urls.static import static

from accounts.views import UserRegisterView
from hashtags.views import HashTagView
from hashtags.api.views import TagTweetAPIView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r"^admin/", admin.site.urls),
    url(r"^$", TweetListView.as_view(), name='home'),
    url(r"^search/$", SearchView.as_view(), name='search'),
    url(r"^tags/(?P<hashtag>.*)/$", HashTagView.as_view(), name='hashtag'),
    url(r"^tweet/", include('tweets.urls', namespace='tweet')),
    url(r"^api/tweet/", include('tweets.api.urls', namespace='tweet-api')),
    url(r"^api/tags/(?P<hashtag>.*)/$",
        TagTweetAPIView.as_view(),
        name='tag-tweet-api'),
    url(r"^api/search/$", SearchTweetAPIView.as_view(), name='search-api'),
    url(r"^api/", include('accounts.api.urls', namespace='profiles-api')),
    url(r"^register/$", UserRegisterView.as_view(), name='register'),
    url(r'^', include('django.contrib.auth.urls')),
    url(r"^", include('accounts.urls', namespace='profiles')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
示例#12
0
from accounts.views import UserRegisterView, FirmaRegisterView, LoginView, logout_view, OpiekunRegisterView
from SRP.views import lista_praktyk, lista_praktyk_firma, stworz_Praktyke, edytuj_praktyke, usun_praktyke, main_page, \
    user_profile, dolaczdopraktyk, listafirm, activefirm, edytuj_praktyke_opiekun, usun_praktyke_opiekun

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', main_page, name='main'),
    path('main/', main_page, name='main_page'),
    path('login/', LoginView.as_view(), name='login'),
    path('logout/', logout_view, name='logout'),
    path('signup_opiekun/',
         OpiekunRegisterView.as_view(),
         name='signup_opiekun'),
    path('signup_firm/', FirmaRegisterView.as_view(), name='signup_firm'),
    path('signup/', UserRegisterView.as_view(), name='signup'),
    path('user_settings/', user_profile, name='user_settings'),
    path('listafirm/', listafirm, name='listafirm'),
    path('listafirm/activefirm/<int:id>', activefirm, name='activefirm'),
    path('praktyki/', lista_praktyk, name='praktyki'),
    path('praktyki_firma/', lista_praktyk_firma, name='praktyki_firma'),
    path('str_pr/', stworz_Praktyke, name='create_practice'),
    path('praktyki/edytuj_praktyke/<int:id_Praktyki>',
         edytuj_praktyke,
         name="edytuj_praktyke"),
    path('praktyki/edytuj_praktyke_opiekun/<int:id_Praktyki>',
         edytuj_praktyke_opiekun,
         name="edytuj_praktyke_opiekun"),
    path('praktyki/usun_praktyke/<int:id_Praktyki>',
         usun_praktyke,
         name="usun_praktyke"),
示例#13
0
# Django imports.
from django.urls import path

# App imports.
from accounts.views import UserRegisterView, UserLoginView

urlpatterns = [
    # Route to register users.
    path(r'register/', UserRegisterView.as_view(), name='user-register'),
    # Route to login registered users.
    path(r'login/', UserLoginView.as_view(), name='user-login')
]