""" from django.conf.urls import url, include from django.contrib import admin from django.views.generic import RedirectView from article.views import ArticleDelete, ArticleList, ArticleDetail, ArticleEdit, ArticleUpdate from auth.views import Login, Logout from comment.views import CommentAdd,CommentDelete urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', RedirectView.as_view(url='article')), url(r'^article/$', ArticleList.as_view(), name='article_list'), url(r'^tag/(?P<tag_id>[0-9]+)/$', ArticleList.as_view()), url(r'^article/(?P<article_id>[0-9]+)/$', ArticleDetail.as_view()), url(r'^article/edit/(?P<article_id>[0-9]+)/$', ArticleEdit.as_view()), url(r'^article/update/$', ArticleUpdate.as_view(), name='article_edit'), url(r'^article/delete/$', ArticleDelete.as_view(), name='article_delete'), url(r'^article/add/$', ArticleEdit.as_view(), name='article_add'), url(r'^comment/add/$',CommentAdd.as_view(),name='comment_add'), url(r'^comment/delete/$',CommentDelete.as_view(),name='comment_delete'), url(r'^login/$', Login.as_view(), name='login'), url(r'^logout/$', Logout.as_view(), name='logout') ]
from django.urls import path from auth.views import Login, Logout urlpatterns = [ path('login/', Login.as_view(), name="auth_login"), path('logout/', Logout.as_view(), name="auth_logout"), ]
def setUp(self): self.request = RequestFactory().get('/logout/') self.request.session = {'tsuru_token': 'my beautiful token'} self.response = Logout.as_view()(self.request)
def setUp(self): self.request = RequestFactory().get('/logout/') self.request.session = {} self.response = Logout.as_view()(self.request)
def internal_server_error(e): return render_template('500.html') app.add_url_rule('/', view_func=Index.as_view('index', template_name='index.html', rsession=rsession)) app.add_url_rule('/dashboard', view_func=DashboardView.as_view( 'dashboard', template_name='dashboard.html', db=db, rsession=rsession)) app.add_url_rule('/auth', view_func=AuthBackend.as_view('auth', db=db, rsession=rsession)) app.add_url_rule('/logout', view_func=Logout.as_view('logout', rsession=rsession)) def main(): app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.config['DEBUG']) if __name__ == '__main__': main()
from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required from auth.views import Register, Login, Logout from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^register/$', login_required(Register.as_view()), name='register'), url(r'^login/$', Login.as_view(), name='login'), url(r'^logout/$', Logout.as_view(), name='logout'), )