Search Customers that are part of the logged on User's Business?
Let's break this down into tasks. I'm using values() to limit the request to what we're interested in, as I can then use that result to filter further.
#First you want to get all the businesses the logged in user owns
#(Currently they can only own one, so you could use get rather than filter,
#but you might change that later and this approach will still work)
qs_owned_businesses = BusinessOwner.objects.filter(user = request.user).values('business_id')

#next you want to get all the customers of those businesses
qs_biz_customers = Customer.objects.filter(business_id__in= qs_owned_businesses).values('user_id')

#finally you want to filter those customers further based on your form field
#remember, the icontains criteria needs to refer to a field
#here we're looking at username, but you might use last_name or something else.
results = User.objects.filter(username__icontains=query, id__in=qs_biz_customers)

results should now be a list of users you can cycle through in your template to show names, usernames etc.

The code I currently have is this, in my views.py I can't figure out how to set up my search function. All other functions work.
models.py
class User(AbstractUser):
    """User can be Employee or Customer"""

class Business(models.Model):
    business = models.CharField(max_length=50)

class BusinessOwner(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, null=True )
    business = models.ForeignKey(Business, on_delete=models.CASCADE, null=True)

class Customer(models.Model):
    """ Customer-specific information """
    user = models.OneToOneField(User, on_delete=models.CASCADE, null=True )
    business = models.ForeignKey(Business, on_delete=models.CASCADE, null=True)

class Employee(models.Model):
    """ Employee-specific information """
    user = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
    business = models.ForeignKey(Business,  on_delete=models.CASCADE, null=True, blank=True)`

forms.py
class UserForm(UserCreationForm):
    class Meta:
        model = User
        fields = ( "username", "email", "password1", "password2", "first_name", "last_name", )


class BusinessOwnerForm(forms.ModelForm):
. . . no fields
class EmployeeForm(forms.ModelForm):
. . . no fields

class CustomerForm(forms.ModelForm):
. . . no fields

class BusinessForm(forms.ModelForm):
    class Meta:
        model = Business
        fields = ( "business",  )

views.py (user creation process)
def searchUsers(request):
    qs_owned_businesses = BusinessOwner.objects.filter(user = request.user).values('business_id')
    qs_biz_customers = Customer.objects.filter(business_id__in=qs_owned_businesses)
    if request.method == "GET":
        query = request.GET.get('search')
        if query == '':
            query = 'None'
    results = User.objects.filter(username__icontains=query, id__in=qs_biz_customers)
    return render(request, 'search_users.html', {'query': query, 'results': results})
    
    


#example of hows employees and customers are created in my views:
def employeeCreation(request):
    """Creates an Employee"""
    if request.method == "POST":
        employee_form = EmployeeForm(request.POST)
        user_creation_form = UserForm(request.POST)
        if (user_creation_form.is_valid() and employee_form.is_valid()):
            employee_form.instance.business = request.user.businessowner.business
            new_user = user_creation_form.save(commit=False)
            employee_form.instance.user = new_user
            user_creation_form.save()
            employee_form.save()
            messages.success(request, "You Have Created An Employee" )
            return redirect("user-homepage")
        else:
            messages.error(request, "Try creating an Employee Again something went wrong.")
    employee_form = EmployeeForm()
    user_creation_form = UserForm()
    return render (request, "registration/employee_creation.html", 
        context={"user_creation_form": user_creation_form, 
                "employee_form": employee_form,
                    })


def customerCreation(request):
. . . functions is exactly the same as employee creation just for a customer. The Business owner's business is used as a starting point to build employees off of. I didn't incldue that view because it's not necessary for this and stack overflow limits how much code I put here.


search_users.html


{% if results %}
 you Searched for {{ query }}  . . 
    {% for x in results %}
        {{ x }}<p></p>
    {% endfor %}

{%endif %}```
I have tried using Q, icontain ,.filter() and django-filter, but this is a tricky search criteria that I can't get to work.
navbar search feature:
       <form action="{% url 'search-users' %}" class="form-inline" method="get">
      <div class="form-group mx-sm-3 mb-2">
      <label for="" class="sr-only">search</label>
      <input name="search" type="" class="form-control" id="" placeholder="Keyword">
      </div>
     <button type="submit" class="btn btn-success btn-lg mb-2">Search</button>
</form>```

