The solution is to generate a filtered QuerySet and pass it into to the table as content.
Here is how the view.py
looks like:
from django_tables2 import RequestConfig
from student_upload.models import ExtendedUser
from admin.tables import ExtendedUserTable
def index(request):
p = ExtendedUser.objects.get_query_set()
table = ExtendedUserTable(p.filter(is_admin = False))
RequestConfig(request).configure(table)
return render(request, 'admin/index.html', {'table': table})
The tables.py
is unchanged.
class ExtendedUserTable(tables.Table):
class Meta:
model = ExtendedUser