nigma / django-easy-pjax Goto Github PK
View Code? Open in Web Editor NEWEasy PJAX for Django
License: BSD 3-Clause "New" or "Revised" License
Easy PJAX for Django
License: BSD 3-Clause "New" or "Revised" License
request.META["QUERY_STRING"] = smart_str(qs.urlencode())
fixes the problem (Django 1.7)
This relates to this issue:
Using 'data-pjax=0' with the link doesn't seem to work in this case.
This app still uses a deprecated and removed feature of Django.
Error
ImportError: cannot import name 'add_to_builtins'
Backtrace
(env)user@server:~/Projects/pjax$ ./project/manage.py runserver --settings=project.settings.test
Traceback (most recent call last):
File "./project/manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "/home/user/Projects/pjax/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/user/Projects/pjax/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/home/user/Projects/pjax/env/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/user/Projects/pjax/env/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/user/Projects/pjax/env/lib/python3.4/site-packages/django/apps/config.py", line 86, in create
module = import_module(entry)
File "/home/user/Projects/pjax/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/user/Projects/pjax/env/lib/python3.4/site-packages/easy_pjax/__init__.py", line 14, in <module>
from django.template import add_to_builtins
ImportError: cannot import name 'add_to_builtins'
Hi,
any solution for appending js and css files to base?
{% block extrajs %}
js code
{% endblock %}
I'm having an issue getting pjax to work on nested pages. For example, navigation from the homepage to the blog main page works as intended, however when you then navigate to a specific blog post from that blog main page, the page is reloaded.
I have checked that I have my pjax template tag in place and that my settings.py file is properly configured for Django 1.8+.
Do you know of any reason why this might be happening? I can share code if necessary.
I love the simplicity and DRY'ness of your solution, but I think I'm accomplishing the same effect using Django's built-in is_ajax
function in the {% extends %}
tag, a trick I learned here: http://source.mihelac.org/2011/07/13/extending-different-base-template-ajax-requests-dj/745
It doesn't work with other Django class-based views such as FormView, CreateView etc.
When you use any other class-based view aside TemplateView, django is not able to render the context properly. Making the page messy
In django 1.9a1 add_to_builtins
was removed. You're now supposed to put this into settings.TEMPLATES['OPTIONS']['builtins']
.
@nigma If there is any hope of it getting merged and released I may make a PR that introduces a code side check whether we're in django 1.9+ and add documentation on putting easy-pjax into template options.
Traceback:
(project)kondou:project/ (master) $ ./manage.py shell
Traceback (most recent call last):
File "/home/kondou/git/project/lib/python3.4/site-packages/easy_pjax/__init__.py", line 15, in <module>
from django.template import add_to_builtins
ImportError: cannot import name 'add_to_builtins'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/kondou/git/project/lib/python3.4/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/home/kondou/git/project/lib/python3.4/site-packages/django/core/management/__init__.py", line 324, in execute
django.setup()
File "/home/kondou/git/project/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/kondou/git/project/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/kondou/git/project/lib/python3.4/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/home/kondou/git/project/lib64/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/kondou/git/project/lib/python3.4/site-packages/easy_pjax/__init__.py", line 18, in <module>
from django.template.base import add_to_builtins
ImportError: cannot import name 'add_to_builtins'
Could you please help us decide which application to choose between yours and the venerable jacobian's django-pjax ?
Maybe a comparative snippet of code would do it...
Thanks a lot !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.