在 blog app 下创建 urls.py, 定义该 app 下自有的 url : new/story from blog import views from django.conf import settings from django.conf.urls.static import static from django.conf.urls import url, include urlpatterns = [ url(r'new/story', views.introduce), ]+ s
外键和表关系 外键是属于数据库级别的,在MySQL中,表有两种引擎,一种是InnoDB,另外一种是myisam.如果使用的是InnoDB引擎,是支持外键约束的.外键的存在使得ORM框架在处理表关系的时候异常强大.因此这里我们首先来介绍外键在Django中的使用. 类定义为 class ForeignKey(to,on_delete,**options).第一个参数to是应用的哪个模型(也就是应用的表),第二个参数on_delete在使用外键应用的模型数据被删除了,这个字段该如何处理.举例说明,如
using UnityEngine; using System.Collections; using System.Collections.Generic; using System.IO; <pre class="csharp" name="code"> public static List<string> nameArray = new List<string>(); /// <summary> /// 依据指定的