Created
October 8, 2013 03:26
-
-
Save npardington/6879014 to your computer and use it in GitHub Desktop.
Taken from djangotables2 example. Used in a blog post about frameworks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tutorial/models.py | |
class Person(models.Model): | |
name = models.CharField(verbose_name="full name") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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