Stream

Pinned by moderator

Christian Bertschy
moderator

News  - 
 
Great effort everyone, we reached the next level on Stackexchange! Now it's time to commit yourselves :-):
http://area51.stackexchange.com/proposals/86758/django-cms

It's really easy to commit to our proposal, just watch the video below.
We need around 200 commitments from you to get to the beta stage.

Thank you for your continued support!
18
1
Martin Koistinen's profile photo
6 comments
 
Big thanks to everyone who already has done so, but we need 62 more people! If you haven't already go here: http://area51.stackexchange.com/proposals/86758/django-cms please, thank you!
Add a comment...

Cristina Luis

Community Support  - 
 
Hi,

New to DjangoCMS and interested in the possible ways to implement having multiple sites running from the same project with most of the data separate. I realize there may be no one right way to do it, just looking for different views and the pluses and minuses.

The plan is to have multiple sites with the same functionality for several different (but related) organizations.They will each have their own content (for the most part) and styling, which leads me to think that the easiest solution is to have multiple sites, each with their own settings, templates, and SITE_ID, each using a different database.

I think, though, that in the future it would be nice for all of the sites/organizations to be available to share the same events calendar data. A few ways to do it, as far as I can see it:
- maintain the site separation, set up events to be fetched via an http API (in other words, make the events functionality a completely separate system)
- have the sites all use the same database (requires keeping track of 'site' in all models?)
- have the sites all use the same database just for the events app (?)

I appreciate any thoughts on this. 
1
Peter Bittner's profile photoCristina Luis's profile photo
3 comments
 
+Leonardo Jimenez, thanks. What exactly does djangocms-multisite allow me to do? What does django-multisite do that the Sites framework wouldn't allow me to do normally?
+Peter Bittner, thanks -- I want the django-cms functionality available for each site (each site with their own CMS-controlled content), so I think there's a bit more work needed, no? Presumably that's what the djangocms-multisite middleware is supposed to do, though it's not clear to me.
Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi guys One simple question .. it is posible create in the same page extension two models...

Something like this... my models.py

class IconExtension(PageExtension):

image = models.ImageField(upload_to='icons', blank=True)
description_short = models.TextField(blank=True, null=True, verbose_name="Short Description")
description_large = models.TextField(blank=True, null=True, verbose_name="Large Description")


extension_pool.register(IconExtension)

class HomeExtension(PageExtension):
home_text = models.TextField(blank=True, null=True, verbose_name="Short Description")
extension_pool.register(HomeExtension)

in my cms_toolbar I have this....

@toolbar_pool.register
class IconExtensionToolbar(ExtensionToolbar):
# defines the model for the current toolbar
model = IconExtension
model = HomeExtension

def populate(self):

# setup the extension toolbar with permissions and sanity checks
current_page_menu = self._setup_extension_toolbar()
# if it's all ok
if current_page_menu:
# retrieves the instance of the current extension (if any) and the toolbar item URL
page_extension, url = self.get_page_extension_admin()
if url:
# adds a toolbar item
current_page_menu.add_modal_item(_('CMS Extensions'), url=url,
disabled=not self.toolbar.edit_mode)



class HomeExtensionToolbar(ExtensionToolbar):
# defines the model for the current toolbar

def populate(self):

# setup the extension toolbar with permissions and sanity checks
current_page_menu = self._setup_extension_toolbar()
# if it's all ok
if current_page_menu:
# retrieves the instance of the current extension (if any) and the toolbar item URL
page_extension, url = self.get_page_extension_admin()
if url:
if self.page.is_home:
# adds a toolbar item
current_page_menu.add_modal_item(_('Config Home Page'), url=url,
disabled=not self.toolbar.edit_mode)


The different between both is that the second one only show if I have in home page... right know I don't have any error, but I don't see "Config Home Page" in home page, I have to create a new app for each new one extension page? Thanks!
1
Martin Koistinen's profile photoMaite Piedra Yera's profile photo
2 comments
 
Hi Martin, I try buy give some error, after that I create two separate extension.
Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi everyone I continue working in my Apphooks using Aldryn Apphooks config, I have some question about this...

I have some Health app.. for example...
Health App/ allergy
Health App/ drug
Health App/ vitamins

It is posible in the same page show more that one... for example in the same page Health App/ allergy and Health App/ drug.

Now when I click in plus button this open a Dialog for create a new Health App, and change the new one for the old... there is any possibility to take in page more that one.

And other question.... I only have a index.html file in this App.. so each page that use a Health App render the same page (index.html). Before and after the content of index page I have a placeholder to add information manually, the problem is that each page show the same info... like a placeholder works.. and I want that each page render different info in this area. What is the best way to do that (different kind of placeholder, or create fields inside the page...) How this you guys resolve this issue.

Thanks in advance!
1
Add a comment...

Leonardo Jimenez

Community Support  - 
 
Probably this topic have been discussed before, what is the recommended way to use both easy_thumbnails and sorl.thumbnail in the same project?.

I'm trying to install djangocms-slider and would like to know which are the best practices on this 
1
John-Scott Atlakson's profile photoPaulo Alvarado's profile photo
2 comments
 
A not so clean alternative is to create an app that gets loaded after sorl and before easy-thumbnails, this app should include a templatetags module which unregisters the sorl thumbnail tag and registers it under a separate name
Add a comment...

Peter D

Tuts/Tips/Tricks  - 
 
Hi All,

I'm working on building a custom plugin for displaying web ads. I want to be able to access context information within the plugin class to return things like the user's first name as a method of the class in the template. Here's an example:

from ..models import Ads

@python_2_unicode_compatible
class WebAdListPluginModel(CMSPlugin):
max_records = models.PositiveSmallIntegerField(default=10)

class Meta:
app_label = 'web_ads'

def str(self):
return 'Web Ad List with {0} records'.format(self.max_records)

def list_webads(self):
ads = Ads.objects.order_by('?').filter()[0:self.max_records]
return ads

Now I want to add something like (pseudocode) this as another method on the class (this doesnt work, obviously - the plugin class has no access to the request object):

def user_first_name(self):
return self.request.user.first_name

What is the easiest way to access the context inside the plugin? I've experimented with context template processors, passing data into the context prior to the plugin's loading - i just wonder if i can do it inside the plugin class itself.

Peter

1
Thomas Rega's profile photo

Maite Piedra Yera

Community Support  - 
 
Hy guys ...
What is the best way to create in Constant Variable, that I can use in any `.py` file or '.html file' .


1
Maite Piedra Yera's profile photoSacha Müller Philipps Sohn's profile photo
5 comments
 
It's hard to tell from here. But the error should contain some message which will help you. Did you set DEBUG = True in your settings?

Also check if the following is sufficient:
"health.context_processors.global_settings"

if your app name is health... try preceding it with your projects name!
project_name.health.context_processors.global_settings

or place the context_processors.py where your settings.py/urls.py files are
!




Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi everyone, I have a few question about templates and apps. I create a app using "aldryn-apphooks-config" , thanks Martin, you advices help me a lot, so now I can create different instances of my app, and set this in pages.. so, in different page I have different configuration of the same app.

After that I create a template and set this template to my Health Result page. (you can se the image bellow), the items, that can you see in the left side of the page are submenus of Health Result page.

Each page of submenu has a different instances of my app, so now I try to show the view of my app in the right site of my page...

So when I click in a submenu.. I don't want to move to other page... I only want to change the right site of my page using the info that I set in this instances of my app for this page...

Any idea how to do that..
Here the code of my template...

{% extends "base.html" %}
{% load cms_tags menu_tags%}

{% block title %}{% page_attribute "page_title" %}{% endblock title %}

{% block content %}
<div class="health_template">
<div class="container">
<div class="row">
<div class="col-xs-12 header_health_page">
<h1 class="pipe-title pipe-title--inset">{{ request.current_page.get_page_title }}</h1>
<div class="breadcrumb_um">
<ul>
{% block breadcrumb_mid %}
{% show_breadcrumb %}
{% endblock %}
<ul>
</div>
</div>
<div class="col-xs-2">
<ul class="menu_health">
{% show_sub_menu 1 %}
</ul>
</div>
<div class="col-xs-10">
# here change the content

</div>
</div>
</div>
</div>
{% endblock content %}

1
Sacha Müller Philipps Sohn's profile photo
 
Hmm... as far as i understand your problem: You shouldn't pre-config different instances of the app. Instead I would let your app decide about its state via a GET parameter in the url... e.g.:

http://domain.com/app?view=allergy
http://domain.com/app?view=diagnosis
... and so on...

On the left hand side i would then insert a custom menu which does not care about the cms at all and which would just contain the path of your app and the requirered Parameters
Add a comment...

Jai Kumar

Community Support  - 
 
How do I create a materialize navigation menu in djangocms, making sure layers, toggle, and collapsible functions work
1
Lucas Garcia de Araújo Martins's profile photoJai Kumar's profile photo
2 comments
 
Lucas, thank you for responding
Does that show the navigation in material design? Furthermore, how do I implement materializecss navigation elements? 
Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi everybody, I am working in a web using the Django CMS, I create my template and I assigned this template to my home page.

Now I have my page.html for the rest of my page, the problem is that I have a menu with 3 leves this

Home
Page1
- page 1.1
- page 1.2
- page 1.2.1
- page 1.2.2
Page2
- page 2.1
- page 2.2
Page3

I have this on my page

{% extends "base.html" %}
{% load cms_tags menu_tags %}

{% block title %}{% page_attribute "page_title" %}{% endblock title %}
{% block content %}
{% placeholder "content" %}
{% show_menu 2 0 0 100 %}
{% endblock content %}

but this always show me the second level .. it is possible pass value inside show_menu.

For example calculate the node level and pass to the show_menu??

Thanks!


1
Sacha Müller Philipps Sohn's profile photoMaite Piedra Yera's profile photo
4 comments
 
Thank Sacha I try with show_sub_menu() :)

Add a comment...

About this community

The official community of interest for django CMS developers and users. People looking for general support should consider using the IRC channel: #django-cms, the Google Group (https://groups.google.com/forum/#!forum/django-cms) or StackOverflow (http://stackoverflow.com/) using the *django-cms* tag. If you need urgent or private support, please consider a support SLA from Divio (https://www.divio.com/en/solutions/) or for more ad hoc help, book an hour with one of Divio's specialists (https://divio.appointlet.com/).
 
arteria GmbH open-sources djangocms-inline-comment

As a team of coders, we are used to leave docstrings and inline comments everywhere to facilitate team work. But when working together with our django CMS end users, continuous documentation was rather tedious – until recently.

With djangocms-inline-comment, we have open-sourced a tiny django CMS plugin allowing us to add comments to the structure board. Of course, the comments are only rendered in edit mode and are only visible to staff users.

Another feature is especially useful for our daily work: As in source code, the inline comments can be used to "comment out" things. Just drag a plugin into the inline comment, and it won't be rendered in the content mode anymore.

The plugin supports Django >= 1.8 and django CMS >= 3.3.

Github: https://github.com/arteria/djangocms-inline-comment


djangocms-inline-comment - Plugin for django CMS – Add comments to the structure board and comment out plugins, visible to staff only
2
Martin Koistinen's profile photo
2 comments
 
A related function, that would be a nice addition would be to incorporate a Lorum Ipsum generator (by words/paragraphs) and, for images, specify images that are then pulled in from http://fakeimg.pl/ or similar. Just a thought!
Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi guys I am working in different issue at the same time, but all related with extension.

I create one extension to appear only if I am in home page, and other to the rest of the page.

The Extension for home page set default value from home page and info that is the same in whole page, like info from footer.

To show this info I use that {{request.current_page.homeextension.footer1}}

But this only work if current_page == Home_page

If I go to other page this info is empty.

there is other thing to read the info that I save in home page a show in other page. like request.home_page.homeextension...

I look for but I don't find nothing similar.

thanks in advance!
1
Maite Piedra Yera's profile photopaulo alvarado's profile photo
3 comments
 
Hello Maite,
Page here refers to the Page model on the cms, as such this won't work directly inside of a template.

You'll need something like a custom simple tag https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/#simple-tags to render this.

So if you create the following tag:

def render_footer():
home = Page.objects.get_home()
return home.homeextension.footer2

Then in your template you can do:

{% render_footer %}
Add a comment...

Mark Walker

Community Support  - 
 
I'm having trouble with i18n. My root urls are wrapped with i18n_patterns, and this includes the CMS url include, sitemap & some hard coded apps. Also i18n URLs and i18n JS cataglog as standard paterns.

I've got English & French setup as django languages & CMS languages but when I try to hit `/fr/` I can see a 302 in the console. Here's the console output when I use the CMS toolbar language switcher;

127.0.0.1 - - [09/Nov/2016 13:18:05] "GET /fr/ HTTP/1.1" 302 -
127.0.0.1 - - [09/Nov/2016 13:18:11] "GET /en/ HTTP/1.1" 200 -

I've included the `{% language_chooser %}` in an app's base template. The links this creates are `/en/console/login` and `/fr/login`. Any idea what the FR link removes the app's name from the URL?

Show URLs shows the URLS;

python http://manage.py show_urls -l fr
/fr/ cms.views.details pages-root
/fr/<slug>/ cms.views.details pages-details-by-slug
/fr/admin/ django.contrib.admin.sites.index admin:index

Middleware looks good to me...

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'authentication.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'cms.middleware.utils.ApphookReloadMiddleware',
)
1
Mark Walker's profile photoMartin Koistinen's profile photo
5 comments
 
Some time ago I put together a highly commented demo app that shows how to do these sorts of things. Have a look here: https://github.com/aldryn/things/blob/master/things/models.py#L67

I hope this helps!
https://github.com/aldryn/things/blob/master/things/models.py#L67
Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi everyone I try to add rich text format functionality to django TextField using django-tinymce, so I extending the page, but now in my fields I want to include the rich editor

description_short = models.TextField(blank=True, null=True, verbose_name="Short Description")
description_large = models.TextField(blank=True, null=True, verbose_name="Large Description")

I follow the step of the documentation ... So I have this

class IconExtension(PageExtension):
content = HTMLField()
image = models.ImageField(upload_to='icons', blank=True)
description_short = models.TextField(blank=True, null=True, verbose_name="Short Description")
description_large = models.TextField(blank=True, null=True, verbose_name="Large Description")

But content = HTMLField() give me a error in my code
"no such column: cms_extensions_iconextension.content"
so I don't know exactly how to use.. Any idea about that

django-tinymce - TinyMCE integration for Django
1
paulo alvarado's profile photoMaite Piedra Yera's profile photo
2 comments
 
Hi Paulo, thanks,!

Add a comment...

Intelliswift Careers

Job Opportunities  - 
 
Urgently Hiring! Python and Django Engineer for Cupertino, CA. No compromise on quality #pythonjobs #djangojobs #itjobs

Apply Now: http://bit.ly/2eYjZMp

we are looking at Python and Django experts. No compromise on quality.
1
Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi everyone, using Aldryn Apphooks Config I created a AppHook that I can create multiples instances of this and assigned to different page, each instances always show the same view.. index.html

How to know the name of instances in each page to change the view... for example.. I have this in my configuration page.. How to know in the view if I have "Allergy Analysis" and no other...

Thanks
1
Martin Koistinen's profile photo
 
Apphooks Config provides both template tags and utilities for your views. They though of everything! :)
Add a comment...
 
A question about caching:

Hi guys.. I've looked at the default caching settings of djangoCMS and have some questions someone hopefully can answer in here:

1. The defaults for page cache duration and menu cache duration are different. At the moment i don't get the point behind this, because i assume that the menus and the pages are things which should affect each other. Setting a new slug for a page should force a cache invalidation for the menu and the page?!

2. The default values seem pretty low to me - Especially the 60 seconds for the page cache. But that's where the second thing pops in my mind. If everything invalidates correctly. What is the purpose of this cache duration values at all?

3. I've read a comment in the source which says that Caches behave different regarding the maximum lifespan of an item in the cache (Memcached was named regarding this - but still seems to be capable of caching stuff nearly to 30 days). So this might be a valid point to set a cache duration via the settings.

4. Looking into our monitoring it seems that we have roundabout a cache hit rate between 75% and 82% (On another project the maximum hit rate is at 72%). Can anyone recommend what i should look out for in getting a higher hit rate? I am pretty sure we have some context processors inserting stuff into the context which is not cached till now so i will take a look at this first. Right now my first attempt would be to inspect via the debug toolbar which queries are fired against the database and move from there on. So if anyone has some good advice i would appreciate it, links, tutorials, documentation or examples of code :)

Thank you all, and thanks again for this great CMS to the people from divio.

Kind regards
Sacha


2
Add a comment...

Maite Piedra Yera

Community Support  - 
 
Hi guys I have a simple question, I create a app and after that I create a apphook, so now I can use this app in multiples page.

The view of my app show a form with a select that when I click in submit bottom, go to a URL.

My problem is that I have a different URL for each page , so page 1 has URL1 and page2 has URL2.

So with this issue, what is the best way to save the url for each page??

1.- management from de admin ? associate each url with a page
2.- add a field from page extension, and use in the controller to pass to the view??
3.- or other better idea?

Thanks!
1
Martin Koistinen's profile photoMaite Piedra Yera's profile photo
2 comments
 
Thanks Martin, I didn't know this package, I create a my own fields and works perfectly, but now my problems is move this data to the view to my html file...

I have this

class IndexView(AppConfigMixin, generic.ListView):
model = Entry
template_name = 'faq/index.html'

this by default the example in documentation...

In my case my model has this field

url = models.CharField(blank=True, default='', max_length=250)
count = models.CharField(blank=True, default='', max_length=250)
start = models.CharField(blank=True, default='', max_length=250)
status = models.CharField(choices=TYPES_CHOICES, max_length=10)

I want to pass two values to html file
data1 = url+count+start
data2 = url

I try different thinks but, nothing work... any idea or documentation to read about that
Add a comment...

Malte Beckmann

Community Support  - 
 
Could someone help me with setting up a word count for a placeholder field? I suppose since a placeholder field can hold one or more text plugins, it would have to cycle through all text plugins and count each one of them, correct?
1
paulo alvarado's profile photoMalte Beckmann's profile photo
8 comments
 
Thanks Paulo! That's really good to know!
Add a comment...