Skip to content

Instantly share code, notes, and snippets.

@npardington
Created October 8, 2013 03:26
Show Gist options
  • Save npardington/6879014 to your computer and use it in GitHub Desktop.
Save npardington/6879014 to your computer and use it in GitHub Desktop.
Taken from djangotables2 example. Used in a blog post about frameworks.
# tutorial/models.py
class Person(models.Model):
name = models.CharField(verbose_name="full name")
{# tutorial/templates/people.html #}
{% load render_table from django_tables2 %}
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="{{ STATIC_URL }}django_tables2/themes/paleblue/css/screen.css" />
</head>
<body>
{% render_table people %}
</body>
</html>
# tutorial/views.py
from django.shortcuts import render
def people(request):
return render(request, "people.html", {"people": Person.objects.all()})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment