Last active
September 23, 2016 09:37
-
-
Save jieter/1173ba26dfbd883a0eb1c44b516f155b to your computer and use it in GitHub Desktop.
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
# models.py | |
class NamedFloat(models.Model): | |
col1 = models.CharField(max_length=1, primary_key=True) | |
col2 = models.FloatField(blank=True, null=True) | |
# test: | |
@pytest.mark.django_db | |
def test_floatfield(): | |
class Table(tables.Table): | |
class Meta: | |
model = NamedFloat | |
NamedFloat.objects.create(col1='a', col2=2.2) | |
NamedFloat.objects.create(col1='b', col2=6.0) | |
table = Table(NamedFloat.objects.all()) | |
request = build_request('/') | |
RequestConfig(request, {'per_page': 2}).configure(table) | |
template = Template('{% load django_tables2 %}{% render_table table %}') | |
html = template.render(Context(dict(request=request, table=table))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment