'How to pass two or more parameters in Django URL
How can I able to pass two or more parameters in Django URL in this way
api/Data/GetAuditChecklistDataForEdit/HRR6627687%7C458%7CRegular
It is a get method so I can't get the values of the two parameter (SID, Type) so I'm trying to pass it through the URL
Is it possible to pass two or more parameter in this way
views.py:
@api_view(['GET'])
def GetAuditChecklistDataForEdit(request, ticket, SID, Type):
if request.method =='GET':
cursor = connection.cursor()
cursor.execute('EXEC [dbo].[sp_GetAuditChecklistDataForEdit] @ticket=%s, @setid=%s, @Type=%s',
(ticket, SID, Type))
result_set = cursor.fetchall()
data =[]
for row in result_set:
print("GetAuditChecklistDataForEdit",row[0])
data.append({
'QId':row[0],
'Question':row[1],
'AnsOption':row[2],
'Choice':row[3],
'Agents':row[4],
'StreamId':row[5],
'Supervisor':row[6],
'Action':row[7],
'subfunction':row[8],
'region':row[9],
'Comments':row[10],
'TicketType':row[11],
})
return Response(data)
urls.py:
path('Data/GetAuditChecklistDataForEdit/<str:ticket>', GetAuditChecklistDataForEdit, name='GetAuditChecklistDataForEdit'),
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
