WSGIRequest' object has no attribute 'get' error after submitting

I have the following codes:

models.py

class Job(models.Model):
    datetime = models.DateTimeField(default=timezone.now)
    associateddevice = models.CharField(max_length = 50)
    associatedinterface = models.CharField(max_length = 500)
    combinedparameters = models.CharField(max_length = 500)

forms.py

class JobForm(ModelForm):
    class Meta:
        model = Job
        fields = ['associateddevice', 'associatedinterface','combinedparameters']

views.py

def device_port_selected(request, pk):
    
    devices = Device.objects.get(pk=pk)        
    tablename = 'dev_interface_'+str(pk)
    #print("tablename: " +tablename)
    cursor=connection.cursor()
    cursor.execute(f"SELECT interface FROM {tablename} WHERE id >=2")
    righttable = cursor.fetchall()
    cursor.close()
    #print(righttable)     
    if request.method == "POST":
        job = JobForm(request)        
        hostname = devices.hostname
        #print(device)
        
        try:
            selection=request.POST.get('portrange','')
        except:
            selection = ""       
        print(selection)     
        mode=request.POST.get('portmode','')        
        print(mode)        
        status=request.POST.get('portstatus','')
        print(status)
        portpara1 = request.POST.get('portpara1','')
        print(portpara1)
        portpara2 = request.POST.get('portpara2','')
        print(portpara2)
        #combined=mode + ";" +status + ";" + portpara1 + ";" + portpara2
        #print(combined)
        combined={'port_range':selection, 'port_mode':mode, 'port_status':status, 'port_param1':portpara1, 'port_param2': portpara2} 
        combinedfinal = {'device':hostname, 'configuration':combined}
        print(combinedfinal)
        job.combinedparameters=combinedfinal
        print(type(request.POST), '\n', request.POST)

    
        job.save()
       
        

        return redirect('/device/', {'device':Device.objects.all, 'devices':device})
        
    return render(request, 'interface/device_port_selected.html',{'devices':devices, 'righttable':righttable} )

All my request.POST.get are successful and there is data in each. When i press the save button, the print(variable) are printed correctly in my powershell. But I cant seem to save.
My web shows me the error of

'WSGIRequest' object has no attribute 'get'

I tried the following:

The first solution was adding ,'' behind the html name. So it becomes request.POST.get('html name' , '') . But this didnt change the output or solve the error. It still show the same error when i was using request.POST.get('html name') . The 2nd solution was request.GET.get instead of request.POST.get but this give me the same error

Here is the traceback from powershell:

Traceback (most recent call last):
  File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Intern\django_swing\interface\views.py", line 747, in device_port_selected
    job.save()
  File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\forms\models.py", line 459, in save
    if self.errors:
  File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\forms\forms.py", line 170, in errors
    self.full_clean()
  File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\forms\forms.py", line 372, in full_clean
    self._clean_fields()
  File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\forms\forms.py", line 384, in _clean_fields
    value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))
  File "C:\Users\P1338475\.virtualenvs\django_swing-t91g66f4\lib\site-packages\django\forms\widgets.py", line 263, in value_from_datadict
    return data.get(name)
AttributeError: 'WSGIRequest' object has no attribute 'get'

It’s usually a lot more helpful if you post the complete traceback. That will generally help identify the specific line where the problem is occurring.

Sorry about it. I have updated the post with the traceback

The images aren’t being shown - please copy/past the text of the traceback.

Sorry about it. It was hidden within the codes. It should be visible now

Please do not rely on images here. They’re not readable on all devices and I can’t quote sections of them to show or highlight specific items. They also can’t be searched by other people using the forum.

Please copy/paste the text of the traceback.

Sorry about that. I updated the post with the text

This is the entry in the traceback pointing to your code, so it’s failing on this line:

This is an indication that you’ve got something structurally wrong with the instance of the form you’ve created.

That’s this line:

Now, compare what you have to the corresponding code in the example in the Working with forms docs.

I see 2 missing parts. First is is.valid() and the 2nd one will be the empty form in the else part for request.method ==“GET”? Are those 2 missing creating the errors?

No. I posted the exact line that is different between your code and the code in the example. Find that line in the example and you will see the difference.

I just realize that when i looked at it again. Sorry. So it is just because of my job=JobForm(request) is missing job=JobForm(request.POST)

Issue solved. Thank you very much! Really grateful for your help