GithubHelp home page GithubHelp logo

Comments (2)

brianmay avatar brianmay commented on August 29, 2024

Was brain dead when I supplied that patch, the e variable isn't even used, so it should be possible to have to work it with any recent python version:

--- a/django_tables2/columns.py
+++ b/django_tables2/columns.py
@@ -276,7 +276,7 @@ class LinkColumn(Column):
         # and use that to decide whether to render a link or just the default
         try:
             raw = bound_column.accessor.resolve(record)
-        except (TypeError, AttributeError, KeyError, ValueError) as e:
+        except (TypeError, AttributeError, KeyError, ValueError):
             raw = None
         if raw is None:
             return self.default

Also suggest something like this to remove the dependancy on Django 1.3, unless code uses the as_html() function:

--- a/django_tables2/tables.py
+++ b/django_tables2/tables.py
@@ -6,7 +6,6 @@ from django.http import Http404
 from django.utils.datastructures import SortedDict
 from django.template import RequestContext
 from django.template.loader import get_template
-from django.test.client import RequestFactory
 from django.utils.encoding import StrAndUnicode
 import sys
 from .utils import Accessor, AttributeDict, OrderBy, OrderByTuple, Sequence
@@ -285,6 +284,7 @@ class Table(StrAndUnicode):
         generated will clobber the querystring of the request. Use the
         ``{% render_table %}`` template tag instead.
         """
+        from django.test.client import RequestFactory
         request = RequestFactory().get('/')
         template = get_template(self.template)
         return template.render(RequestContext(request, {'table': self}))

from django-tables2.

bradleyayers avatar bradleyayers commented on August 29, 2024

Thanks for this!

from django-tables2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.