tamannasharma
tamannasharma

Reputation: 1

error: Dinucleotides matching query does not exist

I am trying to fetch specific rows from table on the basis of user input in forms. on pressing submit button, getting the following error.

Error:

DoesNotExist at /search/ Dinucleotides matching query does not exist. Request Method: POST Request URL: http://127.0.0.1:8000/search/ Django Version: 4.0.6 Exception Type: DoesNotExist Exception Value:
Dinucleotides matching query does not exist. Exception Location: C:\ssrdb\lib\site-packages\django\db\models\query.py, line 496, in get Python Executable: C:\ssrdb\Scripts\python.exe Python Version: 3.10.5 Python Path: ['C:\ssrdb\Scripts\chick', 'C:\python310.zip', 'C:\DLLs', 'C:\lib', 'C:\', 'C:\ssrdb', 'C:\ssrdb\lib\site-packages'] Server time: Wed, 14 Sep 2022 07:08:27 +0000

views.py

from django.shortcuts import render
from django.views.generic import TemplateView, ListView, DetailView
from ssr.models import Dinucleotides
from ssr.forms import InputForm



# Create your views here.
def homepage(request):
    return render(request,'index.html')

def searchpage(request):
  if(request.method == 'GET'):
    form=InputForm()
    return render(request,'search.html',{'form':form})
 
  else:
    print(request.POST)
    if(request.POST['Motiff']):
       obj1=Dinucleotides.objects.get(SSRtype='Motiff')
       return render(request,'result.html',{'obj1':obj1})

Upvotes: 0

Views: 23

Answers (1)

jatin yadav
jatin yadav

Reputation: 1

first of all, pass data in function and then call query.

Upvotes: 0

Related Questions