def init_data(app, created_models, verbosity, **kwargs):
    from django.contrib.sites.models import Site
    from onlinekit import settings
    from onlinekit.pages.models import Navigation, Layout, LayoutSite
    if Layout in created_models:
        site = Site.objects.get( id = settings.SITE_ID )
        layout = Layout( name = 'default',
                            description = 'This is the default layout.',
                            dir = 'default',
                             )
        layout.save()
        layoutsite = LayoutSite ( site = site ,
                                    layout = layout,
                                    )
        layoutsite.save()

        nav1 = Navigation( site = site,
                                    text = 'Startseite',
                                    link = '/startseite/',
                                    orderno = '0',
                                    )
        nav1.save()
        nav2 = Navigation( site = site,
                                    text = u"Über uns",
                                    link = '/ueber-uns/',
                                    orderno = '5',
                                    )
        nav2.save()
        nav3 = Navigation( site = site,
                                    text = u"Impressum",
                                    link = '/ueber-uns/impressum/',
                                    orderno = '0',
                                    parent = nav2,
                                    )
        nav3.save()
Beispiel #2
0
 def save(self, request=None, **kwargs):
     try:
         ls = LayoutSite.objects.get(site__id__iexact=settings.SITE_ID)
     except LayoutSite.DoesNotExist:
         ls = LayoutSite( site = Site.objects.get(id=settings.SITE_ID) )
     data = self.cleaned_data
     ls.layout = Layout.objects.get(id=int(data['layout']))
     ls.save()
     return ls