tareq
tareq

Reputation: 1339

How to install 3rd party app on FeinCMS?

So I am trying to install this: https://zipfelchappe.readthedocs.org/en/latest/ and have followed the steps there

I am quite confused on how to pull up the urls file from there

For instance I have setup my models.py as below:

from django.db import models

from django.utils.translation import ugettext_lazy as _

from feincms.module.page.models import Page
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.application.models import ApplicationContent
from feincms.module.extensions import datepublisher
from feincms.module.extensions import translations

from zipfelchappe.models import Project


Page.register_templates({
    'title': _('Standard template'),
    'path': 'base.html',
    'regions': (
        ('main', _('Main content area')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ),
    })

Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ('lightbox', _('lightbox')),
    ))

Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('zipfelchappe.urls', _('Zipfelchappe projects')),
))


Project.register_regions(
    ('main', _('Content')),
)

Project.register_extensions(
    'zipfelchappe.extensions.categories',
    #'zipfelchappe.extensions.paypal_receivers',
)

Project.create_content_type(RichTextContent)
Project.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ('lightbox', _('lightbox')),
    ))

When I create my new page I see that there is a Zipfelchappe projects in the drop down and when I add it in my page and view the page I see nothing, though the other content types show...I am assuming this is because there is an issue with my zipfelchappe.urls

Now my urls.py file is this:

from django.conf.urls import patterns, include, url from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'', include('feincms.urls')),
    url(r'^zipfelchappe/paypal/', include('zipfelchappe.paypal.urls')),
)

I am trying to follow the steps in http://www.feinheit.ch/media/labs/feincms/integration.html but I do not quite understand how their example relates to mine. As he seems to be pulling specific models from the example 3rd party app....I do not know what specific model I am to pull

Upvotes: 0

Views: 382

Answers (1)

Hedde van der Heide
Hedde van der Heide

Reputation: 22449

You should not include your 3rd party app urls anywhere so remove that line from your root urls, instead append this to your Project model:

@app_models.permalink
def get_absolute_url(self):
    return ('project_detail', 'zipfelchappe.urls', (), {
        'slug': self.slug,
    })

Or whatever name your detail view can be reversed by (see your zipfelchappe urls module)

This will make the views available to the feincms system as if the current page is the app's root. If this is not what you intend to do you shouldn't bother integrating the app within the cms page structure at all.

You could however "inject" an url within your feincms navigation by using a PagePretender as explained in the documentation.

Upvotes: 0

Related Questions