0
我想從輸入字段(表單是在引導彈出窗口內)保存URL但沒有任何反應,當我點擊保存按鈕。 這是我的html代碼:發佈行動不工作在形式內自舉popover
<div id="popover-content" class="hide">
<form name ="bform" method = "post" action = "{% url 'savebookmark' %}" class ="form-inline">
{% csrf_token %}
<div class="form-group">
<input placeholder = "http://..." name = "url" class = "form-control" type = "text">
<button type = "button" class = "btn btn-danger">Save</button>
</div>
</form>
</div>
views.py
def save_bookmark(request):
bmark = request.POST.get("url")
user = user
obj = UserBookmark(user_id=user,bookmark=bmark)
obj.save()
return HttpResponse("Data saved")
urls.py
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^register/$',views.register, name='register'),
url(r'^login/$',views.login_view, name='login'),
url(r'^register/success/$',views.register_success, name='register_success'),
url(r'^category/$',views.get_category,name='getcategory'),
url(r'^#/$',views.save_bookmark,name='savebookmark'),
]
請指導我我在做什麼錯呢?
哦yes.That是對我而言相當愚蠢的。謝謝:)它的工作 –
是的。我已經upvoted答案 –