我有一个URL文件chat.urls.py:
0x104950000
以及一个message.html模板,用于通过以下格式发送消息:
Option Explicit
Private Sub FindingPortPwwn_Click()
Dim SourcePort As Range
Dim firstaddress As String
Dim i As Long, j As Long, N As Long
Dim counter As Integer
Dim WorkingSheet As Worksheet
'Stopping Application Alerts
Application.DisplayAlerts = False
'OR You can mention the Sheet name
On Error GoTo SheetNotFound:
Sheets("Final Results Sheet").Delete
'Creating a New Results Worksheet.
ThisWorkbook.Worksheets.Add(After:=Worksheets("Input_Worksheet")).Name = "Final Results Sheet"
'Enabling Application alerts once we are done with our task
Application.DisplayAlerts = True
Set WorkingSheet = ActiveWorkbook.Worksheets(2)
WorkingSheet.Activate
N = WorkingSheet.Cells(Rows.Count, "A").End(xlUp).Row
'MsgBox (N)
For i = 1 To N
'MsgBox (WorkingSheet.Cells(i, "A").Value)
'MsgBox (WorkingSheet.Cells(i, "A").Offset(0, 1).Value)
Set SourcePort = WorkingSheet.Cells.Find(WorkingSheet.Cells(i, "A").Value, WorkingSheet.Cells(i, "A"), LookIn:=xlValues)
'MsgBox (SourcePort.Address)
firstaddress = SourcePort.Address
Do
If (InStr(SourcePort.Value, ",")) Then
If WorkingSheet.Cells(i, "A").Offset(0, 2).Value = SourcePort.Offset(0, 1).Value Then
ThisWorkbook.Worksheets(3).Cells(i, "A").Value = WorkingSheet.Cells(i, "A").Value
ThisWorkbook.Worksheets(3).Cells(i, "A").Offset(0, 2) = WorkingSheet.Cells(i, "A").Offset(0, 2).Value
Else
ThisWorkbook.Worksheets(3).Cells(i, "A").Value = WorkingSheet.Cells(i, "A").Value
ThisWorkbook.Worksheets(3).Cells(i, "A").Offset(0, 2).Value = WorkingSheet.Cells(i, "A").Offset(0, 2).Value
ThisWorkbook.Worksheets(3).Cells(i, "A").Offset(0, 2).Interior.Color = RGB(255, 126, 135)
End If
Else
If WorkingSheet.Cells(i, "A").Offset(0, 1).Value = SourcePort.Offset(0, 1).Value Then
ThisWorkbook.Worksheets(3).Cells(i, "A").Value = WorkingSheet.Cells(i, "A").Value
ThisWorkbook.Worksheets(3).Cells(i, "A").Offset(0, 1) = WorkingSheet.Cells(i, "A").Offset(0, 1).Value
Else
ThisWorkbook.Worksheets(3).Cells(i, "A").Value = WorkingSheet.Cells(i, "A").Value
ThisWorkbook.Worksheets(3).Cells(i, "A").Offset(0, 1).Value = WorkingSheet.Cells(i, "A").Offset(0, 1).Value
ThisWorkbook.Worksheets(3).Cells(i, "A").Offset(0, 1).Interior.Color = RGB(255, 0, 0)
End If
End If
Set SourcePort = WorkingSheet.Cells.FindNext(SourcePort)
Loop While Not SourcePort Is Nothing And firstaddress <> SourcePort.Address
MsgBox (SourcePort.Value)
Next i
Exit Sub
SheetNotFound:
MsgBox (" Final Results Worksheet not Found")
End Sub
`urlpatterns = patterns('',
url(r'^message/(?P<username>\w+)/$',views.message,name='message'),
url(r'^message/(?P<username>\w+)/submit/$',views.send_message,name='send_message'),
url(r'^inbox/$',views.inbox,name='inbox'),
url(r'^inbox/(?P<username>\w+)/$', views.inbox_by_user,name='inbox_by_user'),
)`
我用“url'inbox'”代替以前工作的代码,无论我用什么代替表单操作,我总是将html源代码呈现为
<form action="{% url 'inbox' %}" method="post">
{% csrf_token %}
<input type="text" name="text" id="text" value="" />
<label for="message">Enter your message here</label><br />
无论如何。我已经重新启动了服务器,确保我保存了更改,并且它有自己的想法,它总是<input type="submit" value="Send" />
</form>
。当我将该网址改为“收件箱”后,我应该会根据网址看到聊天/收件箱。
答案 0 :(得分:1)
根据评论中的信息,您需要{% url 'chat:inbox' %}
中的{% url 'inbox' %}
而不是form
。