Yes it was a type, otherwise nothing would work lol. Thanks for the reply. 
Mysteriously it is not giving me the server error. I did simplify the html 
so there must have been something in that. Now I'm having a different 
problem. I'm getting "Method Not Allowed: /players/search-player/". I've 
updated the view to 
```
def search_player(request):  
  def post(self, request, **kwargs):
    search_text = request.POST.get("search")
    results = Player.objects.filter(name__icontains=search_text)
    context = {'results': results}
    return render(request, 'Striker/players', context)
```
```
path('striker/players/search-player/', views.search_player, 
name='search-player'),
```
And the simplified template
```
{% extends './base.html' %}
{% load humanize %}

{% block content %}
<section class="bg-black body-font">
  <div class="container px-5 py-2 mx-auto flex flex-wrap">
    <div class="-m-4">
      <div class="p-4 md:w-full">
        <h1 class="text-2xl mb-2 mt-2 text-emerald-500">Current Members</h1>
        <input class="form-control" type="search"
          name="search"
          hx-post="/players/search-player/"
          hx-trigger="keyup changed delay:500ms, search"
          hx-target="#search-results"
        />
          <div class="flex flex-wrap p-2 sm:flex-row" id="search-results">
            {% for player in players %}
            <div class="box-border h-85 w-60 mb-1">
              <div class="mx-2 rounded-lg border-double border-2 
border-emerald-500 px-2 py-2 bordermildblue">
                <div class="bg-gray-800">
                  <h2 class="text-blue-400 text-lg title-font font-medium 
mb-4 button-85"><a
                      href="{% url 'player.detail' player.pk %}" 
title="Link to Player's Toons">{{ player.name }}</a>
                  </h2>
                </div>
                <div class="text-left">
                  <p class="leading-relaxed text-base">GP: {{ 
player.gp|intword }}</p>
                  <p class="leading-relaxed text-base">Toons: {{ 
player.gpChar|intword }}</p>
                  <p class="leading-relaxed text-base">Ships: {{ 
player.gpShip|intword|intcomma }}</p>
                  <p class="leading-relaxed text-base">Allycode: <a 
class="text-blue-500"
                      href="https://swgoh.gg/p/{{ player.allycode }}" 
Title="Link to SWGOH.gg">{{ player.allycode }}</a>
                    <span class="text-xs">.gg</span>
                  </p>
                </div>
              </div>
            </div>
            {% endfor %}
          </div>
      </div>
    </div>
  </div>
</section>

{% endblock content %}
```
On Friday, December 9, 2022 at 4:15:46 PM UTC-7 Ryan Nowakowski wrote:

>
>
> On December 9, 2022 12:10:23 PM CST, Brian <bisco...@gmail.com> wrote:
> >```
> >ValueError: The view Striker.views.search_player didn't return an 
> >HttpResponse object. It returned None instead.
> >```
> >view.py
> >```
> >def search_player(request):
> > print(request)
> > search_text = request.POST.get("search")
> > results = Player.objects.filter(name__icontains=search_text)
> > context = {'results': results}
> > return render(request, 'Striker/partials/player-search-results.html', 
> >context)
> >```
>
> I assume view.py is a typo and you really meant views.py above? If you've 
> got both a view.py and a views.py maybe that's your issue.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e277f97d-cbc8-421b-8a59-fc8aeb0ce840n%40googlegroups.com.

Reply via email to