Reverse for 'editprofile' with no arguments not found. 1 pattern(s) tried: ['editprofile/(?P<role>[^/]+)/(?P<pk>[^/]+)/$']

           {% csrf_token %} ```
This is my template
```<td><a class="btn btn-primary" href="/editprofile/{{i.role}}/{{i.id}}">Click to edit</a></td> ```
If I click on this button then the error occurs.

``` @login_required
   def editprofile(request,role,pk):
       studentdata=models.Student.objects.filter(id=pk).first()
       teacherdata=models.Teacher.objects.filter(id=pk).first()
       cRole = role
       print(role)
       if request.method=="POST":
           fname=request.POST["name"]
           father=request.POST["father"]
           mother=request.POST["mother"]
           phone=request.POST["pnumber"]
           enumber=request.POST["enumber"]
           dob=request.POST["dob"]
           address=request.POST["address"]
           photo=request.FILES["photo"]
           sname=request.POST['sname']
           role=request.POST['role']
           if role == 'teacher' or role=="Teacher":
               print("in")
               Tdata= models.Teacher.objects.filter(id=pk).update_or_create(fullname=fname,father=father,mother=mother,phno=phone,ephno=enumber,dob=dob,address=address,photo=photo,schoolname=sname,role=role)
               Tdata.save()
               print("done saving teacher")
               redirect("/home")
           if role == 'student' or role=="Student":
               print("in")
               rollnumber=request.POST['rollNumber']
               standard= request.POST['standard']
               Sdata= models.Student.objects.filter(id=pk).update_or_create(fullname=fname,father=father,mother=mother,phno=phone,ephno=enumber,dob=dob,address=address,photo=photo,schoolname=sname,role=role,rollNumber=rollnumber,standard=standard)
               Sdata.save()
               print("done saving Student")
               redirect("/home")
       if cRole == "student" or cRole == "Student":
           data={"eData":studentdata}
       else:
           data={"eData":teacherdata}
       return render(request,"editprofile.html",data) ```

This is view function

```urlpatterns=[
   path('',views.index,name='index'),
   path('home/',views.home,name='home'),
   path('log_out/',views.log_out,name="log_out"),
   path('register/',views.register,name="register"),
   path('profile/',views.profile,name='profile'),
   path('editprofile/<role>/<pk>/',views.editprofile,name="editprofile"),
] ```
This is urls.py

Kindly help me with this

First, a side-note: When marking off code for the forum, the three backtick characters must be on lines by themselves. They must not be parts of other lines.

Now, this specific error is likely caused by the page that links to this view, not this view itself. That is the view and template that we’d need to see.