Comments (8)
I briefly tested the patch using one of the Django 1.7 betas and Python
2.7.6. Worked for me, so I decided to share it. I don't use Python 3
with Django, and can't see the error on your screen.
Cheers,
Dan.
On 23/07/14 15:58, David Fischer wrote:
Simply use |{{ datatable }}| with Django 1.7+ Python 3.4 and you will
get a nice error.I guess that someone copy-pasted the class StrAndUnicode in utils.py
https://github.com/pivotal-energy-solutions/django-datatable-view/blob/master/datatableview/utils.py
from the project django_countries
https://bitbucket.org/mariocesar/django-countries/src/6ec34ad8418aa465aab4d24088afaa1bbb857ad4/django_countries/fields.py
without actually testing it.|try:
from django.utils.encoding import StrAndUnicode
except ImportError:
from django.utils.encoding import python_2_unicode_compatible@python_2_unicode_compatible class StrAndUnicode: def __str__(self): return self.code
|
|—
Reply to this email directly or view it on GitHub
#54.
from django-datatable-view.
Hello, I think it is quite obvious that the DatatableStructure does not have a "code" attribute.
I will make a pull request with my release that work for me. Please test it or explain me how to run tests,
Please add a tox.ini to this project to make it more easy to run tests + enable Travis CI hook.
from django-datatable-view.
Nice job :)
On 23/07/14 19:50, David Fischer wrote:
Hello, I think it is quite obvious that the DatatableStructure does
not have a "code" attribute.
I will make a pull request with my release that work for me. Please
test it or explain me how to run tests,Please add a tox.ini to this project to make it more easy to run tests
- enable Travis CI hook.
—
Reply to this email directly or view it on GitHub
#54 (comment).
from django-datatable-view.
You're welcome.
I am lucky to find a project like this one for helping me doing awesome tables :-)
from django-datatable-view.
I've only used it briefly so far, but yeah it's a really neat little tool :)
In addition to the previous issue with Django 1.7 that I stumbled
across, at least in my environment, I did have to hack around it with a
little Javascript to make it resize responsively along with the page. If
you're interested I would be happy to share that, although it's not
related directly to this project so I didn't create a pull request.
Cheers,
Dan.
On 23/07/14 20:07, David Fischer wrote:
You're welcome.
I am lucky to find a project like this one for helping me doing
awesome tables :-)—
Reply to this email directly or view it on GitHub
#54 (comment).
from django-datatable-view.
You're awesome!
I discovered few minutes ago that the table isn't responsive but my website is (thanks to Bootstrap 3).
Eager to see your hack in action!
Thanks,
David
from django-datatable-view.
Haha thank you but I'm really not, still relatively new to Python and
Django compared to some :)
All I did was chuck this Javascript in below the table:
var update_size = function() {
$(DataTables_Table_0).css({ width:
$(DataTables_Table_0).parent().width() });
oTable.fnAdjustColumnSizing();
}
$(window).resize(function() {
clearTimeout(window.refresh_size);
window.refresh_size = setTimeout(function() { update_size(); }, 50);
});
I hope I'm safe in thinking it will be self-explanatory to you, but if
not feel free to let me know.
Hope this helps :)
Dan.
On 23/07/14 20:34, David Fischer wrote:
You're awesome!
I discovered few minutes ago that the table isn't responsive but my
website is (thanks to Bootstrap 3).Eager to see your hack in action!
Thanks,
David
—
Reply to this email directly or view it on GitHub
#54 (comment).
from django-datatable-view.
Hey guys, sorry for the Django 1.7 issue. Looks like I confused the outcome of my testing of the code because 1.6 was the latest release and still included the (deprecated) StrAndUnicode
import. Failure on my part to look at the pull request more closely than the passing tests!
I appreciate the pull request #55 to correct the issue. I've modified the strategy to avoid the StrAndUnicode
base class, though. In the final commit d4bd4a0, I decided to just use the python_2_unicode_compatible
utility directly (backported for earlier versions of Django), which is a graceful no-op function on python 3. I feel that this strategy makes Python 3 the first-class citizen in the code, which seems like the right thing to do!
Sorry again for the trouble!
For your convenience, you can run the provided tests using the included example project (it contains a manage.py
and working settings.py
):
$ cd django-datatable-view
$ datatableview/tests/example_project/manage.py test
You should know though that Django 1.7 changed some stuff about how apps are considered registered (something that is hacked in these tests to provide a separate set of test-only models), so the tests kind of blow up on the 1.7 release candidate right now. I need to sit down and work through that. Tests all pass on python 2 and python 3, if using Django 1.6 or earlier.
from django-datatable-view.
Related Issues (20)
- Double initialization of DatatableView HOT 3
- Table not rendering - compatibility with Django 2 and Python 3? HOT 2
- Can't run in production - Ajax error HOT 1
- GenericIPAddressField HOT 1
- columns based on a queryset HOT 1
- Bootstrap 4 (or later)?
- example_project, when run " manage.py migrate", error occurs!!! HOT 3
- Django 3.1.3 support HOT 2
- ImportError: cannot import name 'get_field_definition (django 3.1.3) HOT 1
- ImportError: cannot import name 'get_datatable_structure' (django 3.1.3) HOT 2
- Unable to search or sort columns with processor but no sources HOT 3
- Performance issues with many (50-100+) x-editable columns
- pypi updates HOT 3
- Column with Foreignkey - limit_choices_to not working as intended
- Selecting rows over several pages with select all HOT 1
- Chain AND searches
- Doesnt work with AWS load balancer HOT 1
- Example Project Missing
- Cannout use distinct on get_initial_queryset()
- How to add buttons for download csv and excel
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-datatable-view.