В виде таблицы отображается подробный вид.Я хочу написать поисковый запрос, который отображает найденный результат.Данные отображаются в виде таблицы и имеют поиск в верхней части.ClientInfo - это таблица, содержащая всю информацию о клиенте.
Models.py
class ClientInfo(models.Model):
client = models.ForeignKey(Clients, on_delete=models.CASCADE)
insurance_name = models.CharField(max_length=250)
cpt_code = models.CharField(max_length=100)
subject = models.CharField(max_length=250)
update = models.CharField(max_length=10000)
date = models.DateTimeField(auto_now_add=True)
update_date = models.DateTimeField(auto_now=True)
update_by = models.CharField(max_length=250)
Detail.html
<table class="table table-bordered table-hover">
<tr>
<th scope="col"><small>INCURANCE NAME</small></th>
<th scope="col"><small>CPT-CODE</small></th>
<th scope="col"><small>SUBJECT</small></th>
<th scope="col"><small>UPDATE</small></th>
<th scope="col"><small> DATE</small> </th>
<th scope="col"><small> UPDATE DATE</small> </th>
<th scope="col"><small> UPDATED BY</small> </th>
<th scope="col"><small>Edit</small></th>
</tr>
</thead>
<tbody>
<tr>
{% for item in client.clientinfo_set.all %}
<td><small> {{ item.insurance_name }}</small></td>
<td><small>{{ item.cpt_code }}</small></td>
<td><small> {{ item.subject }}</small></td>
<td><small><p>{{ item.update }}</p></small></td>
<td><small><p>{{ item.date }}</p></small></td>
<td><small>{{ item.update_date }}</small></td>
<td><small>{{ item.update_by }}</small></td>
<td><small></small><a href="">Edit Info</a></td>
</tr>
<br>
{% endfor %}
</tbody>
view.py
class IndexView(generic.ListView):
template_name = 'update/index.html'
context_object_name = 'all_client'
def get_queryset(self):
return Clients.objects.all()
class DetailView(generic.DetailView):
context_object_name = 'client'
model = Clients
template_name = 'update/detail.html'
class ClientCreate(CreateView):
model = Clients
fields = '__all__'
class ClientInfoCreate(CreateView):
model = ClientInfo
fields = '__all__'
class ClientUpdate(UpdateView):
model = Clients
fields = '__all__'
class ClientInfoUpdate(UpdateView):
model = ClientInfo
fields = '__all__'
class searchClientInfo(generic.DeleteView):
model = ClientInfo
template_name = 'update:detail'
def get_context_data(self, **kwargs):
context =
return context
Я хочу получить любую строку, которая соответствует запросу, который пользователь вводит в поле поиска