I have a view based on classes in which I have a function that performs a query in one of the models:
def get_sympatizers_to_reference(self):
if self.request.GET.get('q'):
self.q = self.request.GET.get('q')
s = Simpatizante.objects.filter(num_documento__contains=self.q).first()
return [s] if s else None
else:
return None
This queryset brings all the records of the model that match the string entered in an input, my question is how can I do so that it does not bring to a specific record in the query.