#boards/views.py

from django.contrib.auth.decorators import login_required
@login_required
def new_topic(request, pk): <!--配置登录后的重定向地址-->
<!----templates/login.html-->
<form method="post" novalidate>
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
{% include 'includes/form.html' %}
<button type="submit" class="btn btn-primary btn-block">Login</button>
</form>

Django入门与实践-第17章:保护视图(完结)的更多相关文章

  1. Django入门与实践-第15章:用户注销(完结)

    # myproject/settings.py LOGOUT_REDIRECT_URL = 'home' http://127.0.0.1:8000/logout/ # myproject/urls. ...

  2. Django入门与实践-第13章:表单处理(完结)

    http://127.0.0.1:8000/boards/1/ http://127.0.0.1:8000/boards/2/ http://127.0.0.1:8000/boards/3/ http ...

  3. Django入门与实践-第26章:个性化工具(完结)

    http://127.0.0.1:8000/boards/1/topics/62/reply/ 我觉得只添加内置的个性化(humanize)包就会很不错. 它包含一组为数据添加“人性化(human t ...

  4. Django入门与实践-第14章:用户注册(完结)

    http://127.0.0.1:8000/signup/ django-admin startapp accounts INSTALLED_APPS = [ 'accounts', ] # mypr ...

  5. Django入门与实践-第12章:复用模板(完结)

    http://127.0.0.1:8000/http://127.0.0.1:8000/boards/1/http://127.0.0.1:8000/boards/2/http://127.0.0.1 ...

  6. Django入门与实践-第11章:URL 分发(完结)

    http://127.0.0.1:8000http://127.0.0.1:8000/boards/1/http://127.0.0.1:8000/boards/2/http://127.0.0.1: ...

  7. Django入门与实践-第25章:Markdown 支持(完结)

    http://127.0.0.1:8000/boards/1/topics/102/reply/ 让我们在文本区域添加 Markdown 支持来改善用户体验. 你会看到要实现这个功能非常简单. 首先, ...

  8. Django入门与实践-第24章:我的账户视图(完结)

    http://127.0.0.1:8000/settings/account/ #好的,那么,这部分将是我们最后的一个视图.之后,我们将专心来改进现有功能. #accounts/views.py fr ...

  9. Django入门与实践-第23章:分页实现(完结)

    http://127.0.0.1:8000/boards/1/ #从现在起,我们将在 board_topics 这个视图中来操作. python manage.py shell from django ...

随机推荐

  1. XE6 c++builder Edit垂直居中

    class TMyEdit : public Vcl::Stdctrls::TEdit { virtual void __fastcall CreateParams(TCreateParams& ...

  2. Excel函数使用

    Excel函数使用: count&countif today&now count count() 仅可以统计数字类型的单元格个数 countif 根据条件来选择统计 countif(D ...

  3. vscode 习惯配置

    { "gitlens.advanced.messages": { "suppressShowKeyBindingsNotice": true }, " ...

  4. tcprstat分析服务的响应速度

    Tcprstat 是免费开源的TCP分析工具,可检测网络通信状态,并且计算请求和响应之间的延迟. 它的输出格式类似 linux 的 vmstat 和 iostat 的输出格式.这个工具能够检测到某个端 ...

  5. visual c++ 中的stdafx.h头文件的作用

    stdafx.h VC工程里面经常见到stdafx.h这个头文件,以前也没有特别注意,但是这个文件用不好经常会出错,所以就GOOGLE了一下,总算是弄清楚了... stdafx的英文全称为:Stand ...

  6. eclipse 使用tomcat7.0建立Dynamic Web Project 时 web.xml的问题

    最近使用Eclipse helios版本结合tomcat7.0建立动态的web项目时,发现在WEB-INF下的web.xml没有了. 解决方案: 建立web项目时,建到第三个下一步时,将 Genera ...

  7. list接口如何使用

    1集合类,在java语言中的java.util包提供了一些集合类,这些集合类又被称作容器. 2区别集合类和数组.(1)数组的长度是固定的,集合的长度是可变的.(2)数组是用来存放基本数据类型的,集合是 ...

  8. IE下设置body{overflow:hidden;}失效Bug

    问题重现: <p>There are no scrollbars on this page in sane browsers</p> html, body, p { margi ...

  9. Validate the date format

    Validate the date format function checkdate(input) { var validformat = /^\d{2}\/\d{2}\/\d{4}$/; //Ba ...

  10. kubeadmin 部署(centos 7)

    安装指定版本docker:# yum list docker-ce --showduplicates | sort -ryum install docker-ce-18.06.1.ce-3.el7vi ...