I want to show only the field which I am searching for.
I have attached views.py, models.py, computer_list.py, models.py in the below link, help appreciated.
all issue link
Please post the code here along with a more detailed description of what you’re trying to achieve. (If nothing else, it preserves a record here of this issue and any identified solution for future reference.)
Note: when posting code, enclose it between lines consisting of three backtick - ` characters to preserve formatting. This means you’ll have one line of ```, followed by your lines of code, then another line of ```.
Example:
# The line above this is ```
def function(self):
return self
# The line after this is ```
I am a new user here and I can’t post multiple files that is why I have uploaded them to the below link. you help appreciated it if you help me to figure it out. I a short form I want to build a student result search application using django. using field: name, regno#, dob to get the result filed displayed.
link: https://nextcloud.sajskillshare.online/index.php/s/cxEPqAN6yiSR4Ts
You don’t need to post the files - copy/paste the relevant contents into the text body of your message, delimited as in the example from my previous reply. We probably don’t need complete files at first, just enough to establish the context of the discussion. (You can find many examples in the other messages in the forum where this is being done.)
And, it would be more helpful if you provided even more details as to what you’re trying to achieve.
Consider the following questions:
- What do you want initially displayed on the page?
- What do you want the user to do to interact with this page?
- What do you want to have happen after the user interaction?
- What do you want displayed as a result of that interaction?
I want to show them only two fields when the search is clicked, but unfornatually my whole forms display.I want like student online result
def computer_list(request):
title = ‘List of all computers’
queryset = Computer.objects.all()
form = ComputerSearchForm(request.POST or None)
context = {
“title”: title,
“queryset”: queryset,
“form”: form,
}
if request.method == ‘POST’:
queryset = Computer.objects.all().order_by(’-timestamp’).filter(computer_name__icontains=form[‘computer_name’].value(),users_name__icontains=form[‘users_name’].value())
context = {
“title”: title,
“queryset”: queryset,
“form”: form,
}
return render(request, "computer_list.html", context)