Skip to content

Commit

Permalink
Added Basic Search Results Page.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhiiva committed Sep 4, 2021
1 parent 870276a commit 6cf723d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
32 changes: 32 additions & 0 deletions agagd/agagd_core/tables/beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# DJango Imports
import django_tables2 as tables

# AGAGD Column Imports
from agagd_core.tables.core import ChapterColumn
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.utils.safestring import mark_safe
Expand Down Expand Up @@ -180,6 +183,35 @@ class Meta:
template_name = "django_tables2/bootstrap4.html"


class SearchResultsTable(tables.Table):
member_id = tables.LinkColumn(
"member_detail", kwargs={"member_id": tables.A("member_id")}
)
chapter_id = ChapterColumn(verbose_name="Chapter")
players__rating = tables.Column(verbose_name="Rating")
country = tables.LinkColumn(
"country_detail", kwargs={"country_name": tables.A("country")}
)
full_name = tables.LinkColumn(
"member_detail", kwargs={"member_id": tables.A("member_id")}
)

class Meta:
model = agagd_models.Member
fields = ("full_name", "state", "players__rating", "renewal_due", "country")
sequence = (
"full_name",
"players__rating",
"chapter_id",
"country",
"state",
"renewal_due",
"member_id",
)
attrs = default_bootstrap_header_column_attrs
template_name = "django_tables2/bootstrap4.html"


class Top10DanTable(tables.Table):
pin_player = tables.Column(
orderable=False,
Expand Down
17 changes: 17 additions & 0 deletions agagd/jinja2/beta.search_results.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "beta.base.html" %}

{% block content %}

<div class="container my-4">
<div class="row">
<div class="col mx-0 px-0">
<h3>Search Results for {{ search_query }}</h3>
</div>
</div>
<div class="row">
<div class="col mx-0 mb-2 pb-4 px-0">
{{ member_results_table.as_html(request) }}
</div>
</div>
</div>
{% endblock %}

0 comments on commit 6cf723d

Please sign in to comment.