我收到一条错误消息:
package Snomed.Snomed;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Date;
import catalog.Root;
public class Snomedinfo {
public void snomedinfoinsert()
{
Root oRoot = null;
ResultSet oRsSelect = null;
PreparedStatement oPrStmt = null;
PreparedStatement oPrStmt2 = null;
PreparedStatement oPrStmtSelect = null;
String strSql = null;
String strSql2 = null;
String snomedcode=null;
ResultSet oRs = null;
String refid = null;
String id = null;
String effectivetime = null;
String active = null;
String moduleid = null;
String conceptid = null;
String languagecode = null;
String typeid = null;
String term = null;
String caseSignificanceid = null;
int count = 0;
final int batchSize = 1000;
try{
oRoot = Root.createDbConnection(null);
strSql = "SELECT id FROM snomed_conceptdata WHERE active=1 ";
oPrStmt2 = oRoot.con.prepareStatement(strSql);
oRsSelect = oPrStmt2.executeQuery();
while (oRsSelect.next()) {
snomedcode = Root.TrimString(oRsSelect.getString("id"));
String sql = "INSERT INTO snomedinfo_data (refid,id,effectivetime,active,moduleid,conceptid,languagecode,typeid,term,caseSignificanceid)SELECT refid,id,effectivetime,active,moduleid,conceptid,languagecode,typeid,term,caseSignificanceid from snomed_descriptiondata WHERE conceptid =? AND active=1" ;
oPrStmtSelect = oRoot.con.prepareStatement(sql);
oPrStmtSelect.setString(1,snomedcode);
oPrStmtSelect.executeUpdate();
}
//oPrStmtSelect.executeBatch();
System.out.println("done");
}
catch (Exception e) {
e.printStackTrace();
}
finally {
oRsSelect = Root.EcwCloseResultSet(oRsSelect);
oRs = Root.EcwCloseResultSet(oRs);
oPrStmt = Root.EcwClosePreparedStatement(oPrStmt);
oPrStmt = Root.EcwClosePreparedStatement(oPrStmt2);
oPrStmt = Root.EcwClosePreparedStatement(oPrStmtSelect);
oRoot = Root.closeDbConnection(null, oRoot);
}
}
public static void main(String args[] ) throws Exception
{
Snomedinfo a = new Snomedinfo();
a .snomedinfoinsert();
}
}
我认为NoReverseMatch at /books/
Reverse for 'urlvar' not found. 'urlvar' is not a valid
view function or pattern name.
标签在books / index.html中无法正常工作
但是我不知道该怎么解决。
这是我的代码:
books / urls.py
{% with %}
templates / books / index.html
from django.conf.urls import url
from books import views
urlpatterns = [
url(r'^$', views.BooksModelView.as_view(), name='index'),
url(r'^book/$', views.BookList.as_view(), name='book_list'),
url(r'^author/$', views.AuthorList.as_view(), name='author_list'),
url(r'^publisher/$', views.PublisherList.as_view(), name='publisher_list'),
url(r'^book/(?P<pk>\d+)/$', views.BookDetail.as_view(), name='book_detail'),
url(r'^author/(?P<pk>\d+)/$', views.AuthorDetail.as_view(), name='author_detail'),
url(r'^publisher/(?P<pk>\d+)/$', views.PublisherDetail.as_view(), name='publisher_detail'),
]
答案 0 :(得分:1)
urlvar
是一个变量,因此您在urlvar
标记中使用{% url %}
而不是字符串'urlvar'
。
<li><a href="{% url urlvar %}">{{ modelname }}</a></li>
如果愿意,可以在标记中构造URL模式名称,或者如果发现可读性更高,则保留with
标记。
<li><a href="{% url 'books:'|add:modelname|lower|add:'_list' %}">{{ modelname }}</a></li>
由于在反向访问URL时使用的是'books:
名称空间,因此应在books/urls.py
文件中设置app_name
。
from django.conf.urls import url
from books import views
app_name = 'books'
urlpatterns = [
...
]