我正在使用
,我有两个实体:from datetime import datetime
from django.conf.urls import url
import django.contrib.auth.views
import app.forms
import app.views
# Uncomment the next lines to enable the admin:
# from django.conf.urls import include
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
# Examples:
url(r'^$', app.views.home, name='home'),
url(r'^contact$', app.views.contact, name='contact'),
url(r'^about', app.views.about, name='about'),
url(r'^Register', app.views.Register, name='Register'),
url(r'^problemreports$', app.views.problemreports, name='problemreports'),
url(r'^problemreports/NewItem', app.views.PRNewItem, name='PRNewItem'),
url(r'^problemreports/MyProblemReports', app.views.myPRs, name='myPRs'),
url(r'^problemreports/Closed', app.views.Closed, name='Closed'),
url(r'^problemreports/SearchPRs', app.views.SearchPRs, name='SearchPRs'),
url(r'^problemreports/(\d{1,10})', app.views.EditPR, name='EditPR'),
url(r'^login/$',
django.contrib.auth.views.login,
{
'template_name': 'app/login.html',
'authentication_form': app.forms.BootstrapAuthenticationForm,
'extra_context':
{
'title': 'Log in',
'year': datetime.now().year,
}
},
name='login'),
url(r'^logout$',
django.contrib.auth.views.logout,
{
'next_page': '/',
},
name='logout'),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
]
当我查询from datetime import datetime
from django.conf.urls import url
import django.contrib.auth.views
import app.forms
import app.views
# Uncomment the next lines to enable the admin:
# from django.conf.urls import include
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
# Examples:
url(r'^$', app.views.home, name='home'),
url(r'^contact$', app.views.contact, name='contact'),
url(r'^about', app.views.about, name='about'),
url(r'^Register', app.views.Register, name='Register'),
url(r'^problemreports$', app.views.problemreports, name='problemreports'),
url(r'^problemreports/NewItem', app.views.PRNewItem, name='PRNewItem'),
url(r'^problemreports/MyProblemReports', app.views.myPRs, name='myPRs'),
url(r'^problemreports/Closed', app.views.Closed, name='Closed'),
url(r'^problemreports/SearchPRs', app.views.SearchPRs, name='SearchPRs'),
url(r'^problemreports/(\d{1,10})', app.views.EditPR, name='EditPR'),
url(r'^login/$',
django.contrib.auth.views.login,
{
'template_name': 'app/login.html',
'authentication_form': app.forms.BootstrapAuthenticationForm,
'extra_context':
{
'title': 'Log in',
'year': datetime.now().year,
}
},
name='login'),
url(r'^logout$',
django.contrib.auth.views.logout,
{
'next_page': '/',
},
name='logout'),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
]
在一个单词中匹配时,我得到两个实体。
我只想要简单的实体,但它也匹配列表实体,因为有一个内部字符串匹配列表实体的同义词列表中的单词。 有没有办法只获得匹配整个单词的实体,而不仅仅是其中的一部分。
答案 0 :(得分:0)
没有办法做到这一点。但是,在您的代码中,您可以根据您的实体Type
进行过滤,并只关注价值为#34; Pets"的那个。