batiste / django-page-cms Goto Github PK
View Code? Open in Web Editor NEWOfficial Django page CMS git repository
Home Page: http://django-page-cms.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Official Django page CMS git repository
Home Page: http://django-page-cms.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Hi there,
Please correct me if I'm wrong, but I have found that when I'm specifying my custom placeholder
as untranslated then in admin its still being looked up for language specific content.
I have several languages in a project and also need to be able to specify some content which should be same in all languages.
I've found that there is no check if placeholder shouldn't be translated in admin/init.py when admin form is being created:
232:for placeholder in get_placeholders(template):
233: name = placeholder.name
234: if obj:
235: initial = Content.objects.get_content(obj, language, name)
236: else:
237: initial = None
238: form.base_fields[name] = placeholder.get_field(obj,
239: language, initial=initial)
240:
241: return form
Thanks,
Alexey
I create folder where I store only static-files and create in settings.py parametr as: STATIC_URL and STATIC_ROOT.
But when I want to use TinyMCE that i get this(in develop_server):
"
[12/May/2010 00:10:51] "GET /static/django_page_cms/pages/javascript/pages_form.js HTTP/1.1" 200 4611
[12/May/2010 00:10:51] "GET /media/js/tiny_mce/tiny_mce.js HTTP/1.1" 404 1791
[12/May/2010 00:10:52] "GET /tinymce/filebrowser/ HTTP/1.1" 200 574
[12/May/2010 00:10:52] "GET /debug/m/js/toolbar.min.js HTTP/1.1" 200 3655
[12/May/2010 00:10:52] "GET /media/js/tiny_mce/tiny_mce.js HTTP/1.1" 404 1791
"
I think that it must get more flexable configuration where store my static-media.
What you see about it that fix it?
Thanks.
Hello. Thank you for the perfect product.
I think that Page CMS' delegation mechanism needs to be improved.
As pages/views.py, line 88 says:
result = resolve('/', urlconf)
That's a problem because the evident use case is to delegate a whole site section (with the sub-paths) to a Django application.
The possible solution is:
I'm not sure that my solution is good but I hope you will consider it.
Is it possible to define the stylesheet option for the wymeditor?
Hello,
I've have issues with the revision feature, when you try to change to an old revision for page 2 it calls:
http://localhost:8000/admin/pages/page/2/get-content/112/
but get content ends calling a Content.object.get_content wich is suposed to receive the contentype wich is not a number. So the query fails as theris no content and returns blank.
There seems to be a problem with timezone-aware datetimes in django 1.4. I realize the readme doesn't list django 1.4 as a supported version yet, so I guess you can think of this as an early warning or something to tackle on the way to 1.4-compatibility
I created and saved a page just fine with a 'published' state. When trying to go back and change the state to draft, a 500 error is returned with the following relevant stacktrace:
File "/Users/jannon/VEs/TG/lib/python2.7/site-packages/pages/admin/views.py" in change_status
23. page.save()
File "/Users/jannon/VEs/TG/lib/python2.7/site-packages/pages/models.py" in save
136. self.publication_date <= datetime.now()):
Exception Type: TypeError at /admin/pages/page/2/change-status/
Exception Value: can't compare offset-naive and offset-aware datetimes
And sure enough, editing the pages models.py to read:
from django.utils import timezone
self.publication_date <= datetime.utcnow().replace(tzinfo=timezone.utc)):
causes everything to work just fine
So, I guess django-page-cms should check for the USE_TZ setting and modify its datetime operations accordingly
If that seems like a reasonable approach, I might find some time to work on it and submit a pull request...
Hi Batiste
The demo is throwing an Internal Server error, makes it hard to evaluate the application properly.
Daniel
(windysurf) C:\Users\coderam\workspace\windysurf\src>pip install http://pypi.python.org/packages/source/d/django-page-cms/django-page-cms-1.4.3.tar.gz#md5=d6d284ba7f4144d4b2869ccc068c51d4
Downloading/unpacking http://pypi.python.org/packages/source/d/django-page-cms/django-page-cms-1.4.3.tar.gz
Downloading django-page-cms-1.4.3.tar.gz (2.0Mb): 2.0Mb downloaded
Running setup.py egg_info for package from http://pypi.python.org/packages/source/d/django-page-cms/django-page-cms-1.4.3.tar.gz
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "c:\users\coderam\appdata\local\temp\pip-w2xdja-build\setup.py", line 63, in <module>
'Topic :: Internet :: WWW/HTTP :: Site Management',
File "C:\Python27\Lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "<string>", line 12, in replacement_run
File "C:\Users\coderam\Envs\windysurf\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\egg_info.py", line 252, in find_sources
File "C:\Users\coderam\Envs\windysurf\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\egg_info.py", line 308, in run
File "C:\Users\coderam\Envs\windysurf\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\sdist.py", line 162, in read_template
File "C:\Python27\Lib\distutils\text_file.py", line 128, in close
self.file.close ()
AttributeError: 'NoneType' object has no attribute 'close'
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info\django_page_cms.egg-info
writing requirements to pip-egg-info\django_page_cms.egg-info\requires.txt
writing pip-egg-info\django_page_cms.egg-info\PKG-INFO
writing top-level names to pip-egg-info\django_page_cms.egg-info\top_level.txt
writing dependency_links to pip-egg-info\django_page_cms.egg-info\dependency_links.txt
writing manifest file 'pip-egg-info\django_page_cms.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info\django_page_cms.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "c:\users\coderam\appdata\local\temp\pip-w2xdja-build\setup.py", line 63, in <module>
'Topic :: Internet :: WWW/HTTP :: Site Management',
File "C:\Python27\Lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "<string>", line 12, in replacement_run
File "C:\Users\coderam\Envs\windysurf\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\egg_info.py", line 252, in find_sources
File "C:\Users\coderam\Envs\windysurf\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\egg_info.py", line 308, in run
File "C:\Users\coderam\Envs\windysurf\lib\site-packages\setuptools-0.6c11-py2.7.egg\setuptools\command\sdist.py", line 162, in read_template
File "C:\Python27\Lib\distutils\text_file.py", line 128, in close
self.file.close ()
AttributeError: 'NoneType' object has no attribute 'close'
models.py Page._content_dict in-memory caches content items per page instance. While this is OK if you have 10-30 pages, it becomes a problem if there are +500 pages.
Problem. Every content-item ever fetched stays in that dict until Page class is unloaded (forked process dies). That means if Google starts indexing your content, then you will end-up with the whole DB fetched and stored in-memory.
Solution: use weak references.
Better solution: don't use per-instance cache! There are locmem and memcached already. memcached allows dedicated High-RAM/Low-CPU/Low-HDD server to be used (cheap) for caching. RAM in application servers is too precious to waste it for caching.
P.S. guys, placeholder idea is brilliant, but the overall implementation is... less than ideal)
In the models.py I can see
publication_date and publication_end_date, but there doesn't seem to be a way to set these
try install
http://dumpz.org/64217/
problem solved by editing MANIFEST.in
remove the spaces between /*
Here is something I would like to be able to do in a template:
{% placeholder right as rightmenu with TextInput %}
[and later on]
{% get_page rightmenu as some_page %}
{% pages_submenu some_page %}
So far:
{% get_page variable_id ... %}
fails because variable_id is interpreted as a literal string, not a variable.
{% get_page "my_page_slug" ... %}
fails because quotes surrounding the string argument are not stripped. Thus a page with the slug '"my_page_slug"', not 'my_page_slug' is looked for. This is what your last commit fixes (5eb6fe3)
But {% get_page 9999 ... %} where 9999 is a page ID, works fine.
Tried to fix this by myself and I think what you did in you last commit is not completely right. Each case: "string", variable_id, 9999 must be handled seperatly in the do_get_page() function.
For example I managed to fixed the same issue as you, just by stripping the quotes as suggested in django manual. What I don't understant is why you use FilterExpression objects instead of Variable ones, which as far as I understand, are intended for that purpose. I tried to use Variable instance for the page argument in do_get_page() in the case where that argument is neither a quoted string or a int. Yet I did not manage to get the resolve() method on my Variabnle instance to actually resolve the variable. As a matter of fact something goes wrong in the PlaceholderNode instanciation: the call to get_content_from_context(context) at the first line of the render method returns nothing. Here follows the code:
def do_get_page(parser, token):
"""Retrieve a page and insert into the template's context.
Example::
{% get_page "news" as news_page %}
:param page: the page object, slug or id
:param name: name of the context variable to store the page in
"""
bits = token.split_contents()
if 4 != len(bits):
raise TemplateSyntaxError('%r expects 4 arguments' % bits[0])
if bits[-2] != 'as':
raise TemplateSyntaxError(
'%r expects "as" as the second argument' % bits[0])
if bits[1][0] == bits[1][-1] and bits[1][0] in ("'", '"'):
page = bits[1][1:-1]
elif bits[1].isdigit():
page = bits[1]
else:
page = template.Variable(bits[1])
varname = bits[-1]
return GetPageNode(page, varname)
do_get_page = register.tag('get_page', do_get_page)
Which also requires to add support for variables in get_page_from_string_or_id():
def get_page_from_string_or_id(page_string, context, lang=None):
"""Return a Page object from a slug or an id."""
if type(page_string) == int:
return Page.objects.get(pk=int(page_string))
# if we have a string coming from some templates templates
elif ( isinstance(page_string, SafeUnicode) or
isinstance(page_string, unicode) ):
if page_string.isdigit():
return Page.objects.get(pk=int(page_string))
else:
return Page.objects.from_path(page_string, lang)
elif isinstance(page_string, template.Variable):
return page_string.resolve(context) ## This fails
else:
# in any other case we return the input becasue it's probably
# a Page object.
return page_string
Still digging...
Also wanted to add the following test cases (in test_unit.py), but I cannot manage to run them ! How should I proceed ?
def test_get_page_template_tag_with_page_arg_as_id(self):
"""Test get_page template tag with page argument given as a page id"""
context = Context({})
pl1 = """{% load pages_tags %}{% get_page 1 as toto %}{{ toto }}"""
template = get_template_from_string(pl1)
self.assertEqual(template.render(context), u'None')
page = self.new_page({'id': 1, 'slug': 'get-page-slug'})
self.assertEqual(template.render(context), u'get-page-slug')
def test_get_page_template_tag_with_page_arg_as_variable_containing_page_id(self):
"""Test get_page template tag with page argument given as a page id"""
context = Context({})
pl1 = """{% load pages_tags %}{% placeholder areftosomepage as somepage %}{% get_page somepage as toto %}{{ toto }}"""
template = get_template_from_string(pl1)
self.assertEqual(template.render(context), u'None')
page = self.new_page( { 'id': 1, 'slug': 'get-page-slug'},
contents={ 'areftosomepage': '1',
'title': 'test-page' } )
self.assertEqual(template.render(context), u'get-page-slug')
def test_get_page_template_tag_with_page_arg_as_variable_containing_page_slug(self):
"""Test get_page template tag with page argument given as a page id"""
context = Context({})
pl1 = """{% load pages_tags %}{% placeholder areftosomepage as somepage %}{% get_page somepage as toto %}{{ toto }}"""
template = get_template_from_string(pl1)
self.assertEqual(template.render(context), u'None')
page = self.new_page( {'id': 1, 'slug': 'get-page-slug'},
contents={ 'title': 'test-title',
'areftosomepage': "get-page-slug" } )
self.assertEqual(template.render(context), u'get-page-slug')
Thanks,
Nicolas.
Edit: Fixed test cases so they are more likely to run but still haven't managed to actually run them. Tryed:
./manage test (just runs django tests)
./manage pages
Got lots of output but the result was: ran 0 tests.
./manage pages.tests.test_unit.UnitTestCase
Got a ValueError: label shoud be of the form app.TestCase or app.TestCase.test_method. Tryed such form, no more luck.
Whether installing with pip, or downloading and running python setup.py install (checked in a virtualenv), the locales directory is missing from the installation.
Could be cause pages/locale is missing from MANIFEST.in
When attempting to use the sample cool template the following trace stack happens ad infinitum:
[Sat Apr 07 00:44:22 2012] [error] ERROR Internal Server Error: /admin/pages/page/2/template/images/portfolio/ventilationchamber_thumb.jpg/
[Sat Apr 07 00:44:22 2012] [error] Traceback (most recent call last):
[Sat Apr 07 00:44:22 2012] [error] File "/srv/www/django/webdesign.danols.com/virtualenv/src/django/django/core/handlers/base.py", line 111, in get_response
[Sat Apr 07 00:44:22 2012] [error] response = callback(request, _callback_args, *_callback_kwargs)
[Sat Apr 07 00:44:22 2012] [error] File "/srv/www/django/webdesign.danols.com/virtualenv/src/django/django/contrib/admin/options.py", line 368, in wrapper
[Sat Apr 07 00:44:22 2012] [error] return self.admin_site.admin_view(view)(_args, *_kwargs)
[Sat Apr 07 00:44:22 2012] [error] File "/srv/www/django/webdesign.danols.com/virtualenv/src/django/django/utils/decorators.py", line 91, in _wrapped_view
[Sat Apr 07 00:44:22 2012] [error] response = view_func(request, _args, *_kwargs)
[Sat Apr 07 00:44:22 2012] [error] File "/srv/www/django/webdesign.danols.com/virtualenv/src/django/django/views/decorators/cache.py", line 88, in _wrapped_view_func
[Sat Apr 07 00:44:22 2012] [error] response = view_func(request, _args, *_kwargs)
[Sat Apr 07 00:44:22 2012] [error] File "/srv/www/django/webdesign.danols.com/virtualenv/src/django/django/contrib/admin/sites.py", line 192, in inner
[Sat Apr 07 00:44:22 2012] [error] return view(request, _args, *_kwargs)
[Sat Apr 07 00:44:22 2012] [error] File "/srv/www/django/webdesign.danols.com/virtualenv/lib/python2.6/site-packages/pages/admin/init.py", line 263, in change_view
[Sat Apr 07 00:44:22 2012] [error] raise Http404('The "%s" part of the location is invalid.'
[Sat Apr 07 00:44:22 2012] [error] NameError: global name 'Http404' is not defined
Hi Batiste,
http://packages.python.org/django-page-cms/navigation-template-tags.html#id5
According to this example of using breadcrumbs Django renders this:
<ul>
<a href="/home">Home</a> »
<a href="/home/news">News</a>
</ul>
I think that ul tag isn't necessary there, because it must include li.
Thanks.
I have placed my custom placeholder files in multiple places in the path of my app but my template tags are still not working.
I followed the documentation here:
http://pythonhosted.org/django-page-cms/placeholders.html#create-your-own-placeholder
Do I place the tag in the main installation path for the pages app?
For my installation that would be here:
/usr/local/lib/python2.7/dist-packages/pages/mycustomplaceholders.py
Or do I place it in my app path (tried this but it did not work):
/home/me/mydjangocms/someapp/mycustomplaceholders.py
Hello,
I am Prateek Gupta,a student of 1st year undergraduate course pursuing Bachelors in engineering in computer science from BITS Pilani Goa in India.I am interested to participate in Google summer of code 2012 and seem to find django-page-cms as an interesting project.I currently have fairly good knowledge of JAVA,C and is currently learning Python because of it being a good language and an open source.I am interested to participate and become an active member in open source community and working with django would help me to contribute whatever little i am able to.
Being a beginner hope people can guide me for further step.Hope to get a reply soon.
with regards,
Prateek gupta
I've implemented a limited number of multilingual pages and activated all the standard django language selection stuff. As soon as the multilingual aspect was activated, the site slowed down drastically. The django debug toolbar shows 216 queries generated, one for each piece of content for each page in each language - they all stem from the navigation tags.
Is there a way to avoid this, or a fix that can prevent individual queries being sent for every language variation?
Please, fix it 8491b2e#diff-1
Hi batiste,
http://packages.python.org/django-page-cms/display-content.html#get-page
Here is a little mistake in the docs:
{% get_page "news" news_page %}
There should be as, I believe.
Thanks.
Presumably this is the origin of http://code.google.com/p/django-page-cms/issues/detail?id=199 (btw, it is not clear which issue tracker I should be using)
There is a bug in pages_form.js which causes the browser to attempt to load undefined.gif
I'm not set up to produce a patch file, but here's the fix, starting on line 23:
// Set the publication status
var select = $('#id_status');
var opt = ({ 0: 'draft', 1: 'published', 2: 'expired', 3: 'hidden' })[select.val()];
if (typeof(opt) != "undefined")
{
var img = $('<img src="'+page_media_url+'images/icons/'+opt+'.gif" alt="'+opt+'" />').insertAfter(select);
// disable ajax post if page not already created (add view)
var change_status = (typeof(add_form) !== 'undefined' && add_form) ? 0 : 1;
select.change(function(e) {
pages.update_published_icon('', select, img, change_status);
});
}
BTW, the url had an extra slash in it, which I removed. It worked for me, since page_media_url apparently already has a slash at the end, but if that's not guaranteed, you probably want to add something like page_media_url.replace(/\/?$/,'/')
csrf protection does not work with move page ajax calls
Hello!
I have a weird issue, the pip package does not contain the media issues, so the collectstatic of django-staticfiles does not work at all.
./manage.py makemessages -a
processing language jp
Error: errors happened while running xgettext on forms.py
./pages/admin/forms.py:15: warning: unterminated string
./pages/admin/forms.py:16: warning: unterminated string
./pages/admin/forms.py:17: warning: unterminated string
./pages/admin/forms.py:18: warning: unterminated string
./pages/admin/forms.py:20: warning: unterminated string
./pages/admin/forms.py:21: warning: unterminated string
./pages/admin/forms.py:33: warning: unterminated string
./pages/admin/forms.py:34: warning: unterminated string
./pages/admin/forms.py:32: internationalized messages should not contain the \r' escape sequence ./pages/admin/forms.py:19: internationalized messages should not contain the
\r' escape sequence
./pages/admin/forms.py:16: internationalized messages should not contain the \r' escape sequence ./pages/admin/forms.py:14: internationalized messages should not contain the
\r' escape sequence
does anyone know why "'FileSystemStorage' object has no attribute 'rindex'" is thrown every time I attempt a photo upload using the django-page-cms? I use Django 1.3 and also reproduced this error with uploads on Django 1.4.
class GetContentNode(template.Node):
"""Get content node"""
def init(self, page, content_type, varname, lang):
self.page = page
self.content_type = content_type
self.varname = varname
self.lang = lang
def render(self, context):
context[self.varname] = _get_content(
context,
self.page.resolve(context),
self.content_type.resolve(context),
self.lang
)
return ''
change to
class GetContentNode(template.Node):
"""Get content node"""
def init(self, page, content_type, varname, lang):
self.page = page
self.content_type = content_type
self.varname = varname
self.lang = lang
def render(self, context):
context[self.varname] = _get_content(
context,
self.page.resolve(context),
self.content_type.resolve(context),
self.lang.resolve(context)
)
return ''
I see REST making up in admin but in database of pages I get not converted to html texts. Where I can start docutils handler for such converting?
I've found a problem related to wsgi. I've opened a ticket in the django trac, but it might be a problem of django-page-cms
Look at: http://code.djangoproject.com/ticket/14755
I'm using the latest development version of django and django-page-cms.
I have met such an issue:
I have a lot of static pages, filled in using the placeholders, by different conent.
Content contains links to other pages. Links are hard-coded. The better solution is to use dynamic links, e.g. {% show_absolute_url current_page %}.
This is a big problem to me. I'll try to explore other editor, maybe somewhere, when i input raw html (not visually), it does not escape quotes.
When users download a file, the filename is generally pretty important and having them automatically renamed is less than desirable.
There is an error In the "Tagging" section on this page:
http://pythonhosted.org/django-page-cms/installation.html
It lists the required tagging application as "Tagging" but django-tagging has been replaced by django-taggit as shown here:
https://github.com/batiste/django-page-cms/search?q=taggit&ref=cmdform
The issue was discussed here:
http://groups.google.com/group/django-page-cms/browse_thread/thread/3f3dba5c7eeed168
Failed to load resource: the server responded with a status of 404 (NOT FOUND) http://127.0.0.1:8000/static/pages/javascript/jquery.ui.resizable.js
Uncaught TypeError: Cannot read property 'msie' of undefined
When saving a page as draft while using RealTimePageIndex, it is added to/updated within the search index. This is incorrect and also fails as the publication_date field is NULL.
This presumably also happens for any draft pages that exist when real time indexing is not used but update_index is called.
A possible fix is to add:
def should_update(self, instance, **kwargs):
if instance.status == Page.PUBLISHED:
return True
return False
to the PageIndex and RealTimePageIndex classes within search_indexes.py (this only updates the index with the current instance if it has been published). It may also be worth attempting removal of the instance in case it was added previously as a published page and now changed to draft.
Thanks.
when following the directions here:
http://packages.python.org/django-page-cms/installation.html
and after dependencies are installed running manage.py syncdb raises the following error:
File "../pages/testproj/documents/models.py", line 3, in <module>
from pages.models import Page
File "../pages/models.py", line 17, in <module>
from mptt.models import MPTTModel
ImportError: cannot import name MPTTModel
Version I'm trying is django-page-cms Release 1.4.0
Could you please make django-page-cms to be more compatible with grappelli? Take a look at the pages changelist with grappelli... It doesn't look very nice :/. I think the popularity of grappelli is raising so it would be a nice feature.
Hello,
I think there is a bug in get_comple_slug
.
When I'm trying to get a URL for a page for a different languages (see example below)
I am getting same URL for all languages:
Lets say I have such a piece of template
{% load pages_tags %}
{% for l in LANGUAGES %}
{% show_absolute_url current_page l.0 %}
{# Here I would expect to get different URLs to the same page #}
{# depending on a language #}
{% endfor %}
And here is the piece of get_complete_slug
which would cause the issue:
def get_complete_slug(self, language=None):
"""Return the complete slug of this page by concatenating
all parent's slugs.
:param language: the wanted slug language."""
if self._complete_slug:
return self._complete_slug
self._complete_slug = cache.get(self.PAGE_URL_KEY %
(self.id, language))
...
The self._complete_slug
does not depend on a language specified,
it would hold a slug for a first queried language and would return it for all other languages.
I would like to know your thoughts on this.
Thanks,
Alexey
Hello Batiste!
We are migrating to buildout+pypi distribution for our projects. So, in page-cms's dependencies you declared django-mptt>0.2.1. But last version in pypi is 0.2.1. Running buildout gives an error:
Getting distribution for 'django-mptt>0.2.1'.
While:
Installing django.
Getting distribution for 'django-mptt>0.2.1'.
Error: Couldn't find a distribution for 'django-mptt>0.2.1'.
Could you solve this dependency, please? Is it so necessary to use trunk version of mptt?
Thank you for attention.
Hi, I'm trying to work through the doumentation, but it appears broken. Check this link:
http://packages.python.org/django-page-cms/3rd-party-apps.html#delegate-the-rendering-of-a-page-to-an-application
It starts with a changelog, takes almost 2 minutes to load and has tons of unknown symbols. ����
Can you have a look at this? Thank you
Glazunost
Hi Batiste.
I have found the following code at line 222 of settings.py of current committed code:
PAGE_REAL_TIME_SEARCH = getattr(settings, 'PAGE_REAL_TIME_SEARCH', False):
The : breaks the software. Removing it, Django Page CMS works again!
The correct code is:
PAGE_REAL_TIME_SEARCH = getattr(settings, 'PAGE_REAL_TIME_SEARCH', False)
I hope it helps!
Francesco
If I have multiple roots in a pages tree, the pages_dynamic_tree_menu template tag is also expanding other roots when I display any subpage (as each root has its own mptt numbering).
I found that I can avoid this if I add a supplementary test in the function:
- if page.lft <= current_page.lft and page.rght >= current_page.rght:
+ if page.tree_id == current_page.tree_id and page.lft <= current_page.lft and page.rght >= current_page.rght:
... thus redirecting to same page.
I'm working with Django 1.4.
Possibly this workaround will help (won't work with PAGE_USE_LANGUAGE_PREFIX=True I presume):
diff --git a/pages/models.py b/pages/models.py
index a90802f..2a393eb 100644
--- a/pages/models.py
+++ b/pages/models.py
@@ -262,7 +262,7 @@ class Page(MPTTModel):
return reverse('pages-details-by-path',
args=[language, url])
else:
- return reverse('pages-details-by-path', args=[url])
+ return reverse('pages-details-by-path', args=[url]) + "?language=%s" % language
def get_absolute_url(self, language=None):
"""Alias for `get_url_path`.
diff --git a/pages/templates/admin/pages/page/change_form.html b/pages/templates/admin/pages/page/change_form.html
index 7c55310..01053f2 100644
--- a/pages/templates/admin/pages/page/change_form.html
+++ b/pages/templates/admin/pages/page/change_form.html
@@ -15,7 +15,7 @@
{% block object-tools %}
{% if change and not is_popup %}
<ul class="object-tools">
- {% if has_absolute_url %}<li><a href="{% show_absolute_url page %}" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif %}
+ {% if has_absolute_url %}<li><a href="{% show_absolute_url original request.GET.language %}" class="viewsitelink">{% trans "View on site" %}<
</ul>
{% endif %}
{% endblock %}
This would help us out a lot.
We're using page-cms quite a bit and it would be handy to be able to pull down a consistent, working version when deploying without worrying about any changes made since the last time we pulled.
Using semantic versioning would be awesome: http://semver.org/
Having created a custom placeholder, how does it get loaded?
I tried making an "app" and adding that to the settings.py file, but that didn't work.
I tried "loading" the file directly in the template, but that didn't work.
How/where should I load or import this file?
Thanks!
Every time I run my unit tests or my (dev)server I get a warning about deprecation of the auto_render decorator.
This is because the decorator is still used in pages/admin/views.py
Hi!
I couldn't find this in the code so I can only assume there are no categories here?
The use case is having two sets of pages, which need links under different headings.
A nice way to deal with that is have a category and tie the pages to that.
The ugly-yet-hackish way would be to make the topmost node an empty page and render only its title, not a link, with some kind of if check in the template
Is that the way to go or did I miss something? Is category support on a roadmap?
Thanks!
Why is there a "pages_pagepermissions" table created in the south initial migration file?
There's no other reference to this as far as I can see and it's breaking tests as the model is not in the models.py file so causing this error..
Error: Database test_muchbetter couldn't be flushed. Possible reasons:
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.