Example #1
0
    def test_register_i18n_trees(self):
        register_i18n_trees(['tree3'])
        self.sitetree.global_context = get_mock_context(path='/')

        activate('en')
        self.sitetree.get_sitetree('tree3')
        children = self.sitetree.get_children('tree3', self.t2_root)
        self.assertEqual(len(children), 2)

        activate('ru')
        self.sitetree.get_sitetree('tree3')
        children = self.sitetree.get_children('tree3', self.t1_root)
        self.assertEqual(len(children), 5)
Example #2
0
def register_sitetrees():
    sitetreeapp._DYNAMIC_TREES.clear()
    cache.delete('sitetrees')
    register_i18n_trees(['mainmenu', 'competition_admin', 'footermenu'])
    try:
        register_dynamic_trees((
            compose_dynamic_tree(sitetrees_build('lv'), target_tree_alias='mainmenu_lv', parent_tree_item_alias='sacensibas'),
            compose_dynamic_tree(sitetrees_build('en'), target_tree_alias='mainmenu_en', parent_tree_item_alias='sacensibas'),
            compose_dynamic_tree(sitetrees_build('ru'), target_tree_alias='mainmenu_ru', parent_tree_item_alias='sacensibas'),
            compose_dynamic_tree('velo.manager', target_tree_alias='mainmenu_lv', parent_tree_item_alias='manager'),
        ), reset_cache=True)
    except ProgrammingError:
        print('Seems that migrations should be run.')
Example #3
0
    def test_register_i18n_trees(self):
        register_i18n_trees(['tree3'])
        self.sitetree._global_context = get_mock_context(path='/the_same_url/')

        activate('en')
        self.sitetree.get_sitetree('tree3')
        children = self.sitetree.get_children('tree3', self.t2_root)
        self.assertEqual(len(children), 2)
        self.assertFalse(children[0].is_current)
        self.assertTrue(children[1].is_current)

        activate('ru')
        self.sitetree.get_sitetree('tree3')
        children = self.sitetree.get_children('tree3', self.t1_root)
        self.assertEqual(len(children), 5)
        self.assertFalse(children[1].is_current)
        self.assertTrue(children[2].is_current)
        self.assertFalse(children[3].is_current)
Example #4
0
    def test_register_i18n_trees(self):
        register_i18n_trees(["tree3"])
        self.sitetree._global_context = get_mock_context(path="/the_same_url/")

        activate("en")
        self.sitetree.get_sitetree("tree3")
        children = self.sitetree.get_children("tree3", self.t2_root)
        self.assertEqual(len(children), 2)
        self.assertFalse(children[0].is_current)
        self.assertTrue(children[1].is_current)

        activate("ru")
        self.sitetree.get_sitetree("tree3")
        children = self.sitetree.get_children("tree3", self.t1_root)
        self.assertEqual(len(children), 5)
        self.assertFalse(children[1].is_current)
        self.assertTrue(children[2].is_current)
        self.assertFalse(children[3].is_current)
Example #5
0
    def test_register_i18n_trees(self):
        register_i18n_trees(['tree3'])
        self.sitetree._global_context = get_mock_context(path='/the_same_url/')

        activate('en')
        self.sitetree.get_sitetree('tree3')
        children = self.sitetree.get_children('tree3', self.t2_root)
        self.assertEqual(len(children), 2)
        self.assertFalse(children[0].is_current)
        self.assertTrue(children[1].is_current)

        activate('ru')
        self.sitetree.get_sitetree('tree3')
        children = self.sitetree.get_children('tree3', self.t1_root)
        self.assertEqual(len(children), 5)
        self.assertFalse(children[1].is_current)
        self.assertTrue(children[2].is_current)
        self.assertFalse(children[3].is_current)
Example #6
0
WIKI_SLUG = r"(([\w-]{2,})(/[\w-]{2,})*)"

urlpatterns = i18n_patterns(
    path("", TemplateView.as_view(template_name="homepage.html"), name="home"),
    path("speakers/", include("ilpycon.symposion.speakers.urls")),
    path("dashboard/", dashboard, name="dashboard"),
)

urlpatterns += [
    path("admin/", admin.site.urls),
    path("i18n/", include('ilpycon.i18n')),
    path("account/", include("account.urls")),

    path("proposals/", include("ilpycon.symposion.proposals.urls")),
    path("sponsors/", include("ilpycon.symposion.sponsorship.urls")),
    path("boxes/", include("pinax.boxes.urls")),
    path("teams/", include("ilpycon.symposion.teams.urls")),
    path("reviews/", include("ilpycon.symposion.reviews.urls")),
    path("schedule/", include("ilpycon.symposion.schedule.urls")),
    path(r"blog/", include("pinax.blog.urls", namespace="pinax_blog")),
    path(r"ajax/images/", include("pinax.images.urls",
                                   namespace="pinax_images")),
    path("", include("pinax.pages.urls", namespace="pinax_pages"))
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

register_dynamic_trees(compose_dynamic_tree('ilpycon'), reset_cache=True)
register_i18n_trees(['main'])
Example #7
0
from sitetree.sitetreeapp import register_i18n_trees

from core.views import CalendarView, IndexView
from payment.views import ApplicationPayView, ApplicationOKView
from registration.views import ApplicationUpdate, ApplicationCreate, CompanyApplicationCreate, CompanyApplicationDetail, \
    CompanyApplicationParticipantAdd, MyCompanyApplicationList, CompanyApplicationParticipantAddOK, \
    CompanyApplicationUpdate, ParticipantPDF
from results.views import ResultAllView
from supporter.views import AgencySupporters
from velo.views import CustomAutoResponseView


admin.autodiscover()


register_i18n_trees(['mainmenu', 'competition_admin'])

try:
    register_dynamic_trees((
        compose_dynamic_tree('core', target_tree_alias='mainmenu_lv', parent_tree_item_alias='sacensibas'),
    ))
    register_dynamic_trees((
        compose_dynamic_tree('manager', target_tree_alias='mainmenu_lv', parent_tree_item_alias='manager'),
    ))
except ProgrammingError:
    print 'Seems that migrations should be run.'



js_info_dict = {
    # Not yet used
Example #8
0
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)

if settings.SITE_PREFIX_URL:
    urlpatterns = [
        path('{}'.format(settings.SITE_PREFIX_URL), include(urlpatterns))
    ]

urlpatterns = i18n_patterns(
    *urlpatterns, prefix_default_language=settings.PREFIX_DEFAULT_LANGUAGE)

if settings.SITE_PREFIX_URL:
    apiUrlpatterns = [
        path('{}'.format(settings.SITE_PREFIX_URL), include(apiUrlpatterns))
    ]

urlpatterns += apiUrlpatterns

urlows = [path('', include('OWS.urls'))]

if settings.SITE_PREFIX_URL:
    urlows = [path('{}'.format(settings.SITE_PREFIX_URL), include(urlows))]

urlpatterns += urlows

from sitetree.sitetreeapp import register_i18n_trees

register_i18n_trees(G3W_SITETREE_I18N_ALIAS)
from django.conf import settings
from django.conf.urls.defaults import patterns, url, include
from django.conf.urls.static import static

from django.views.generic.simple import direct_to_template

from django.contrib import admin

import symposion.views

from scipyla2016.schedule.views import poster_list, sprint_list

from sitetree.sitetreeapp import register_i18n_trees


register_i18n_trees(["main"])

urlpatterns = patterns(
    "",
    url(r"^$", direct_to_template, {"template": "homepage.html"}, name="home"),
    url(r"^about/$", direct_to_template, {"template": "about/about.html"}, name="about"),
    url(r"^venue/$", direct_to_template, {"template": "venue/venue.html"}, name="venue"),
    url(r"^lodging/$", direct_to_template, {"template": "venue/lodging.html"}, name="lodging"),
    url(r"^directions/$", direct_to_template, {"template": "venue/directions.html"}, name="directions"),
    url(r"^floorplans/$", direct_to_template, {"template": "venue/floorplans.html"}, name="floorplans"),
    url(r"^restaurants/$", direct_to_template, {"template": "venue/restaurants.html"}, name="restaurants"),
    url(
        r"^plotting_contest/$",
        direct_to_template,
        {"template": "participate/plotting_contest.html"},
        name="plotting_contest",
Example #10
0
                section(_('Budget info'), 'assets', 'BudgetInfo'),
                section(
                    _('Service Environment'), 'assets', 'ServiceEnvironment'
                ),
                section(
                    _('Configuration modules'), 'assets', 'ConfigurationModule'
                ),
                section(
                    _('Configuration classes'), 'assets', 'ConfigurationClass'
                ),
                section(_('Asset holder'), 'assets', 'AssetHolder'),
                section(_('Users list'), 'accounts', 'RalphUser'),
                section(_('Groups list'), 'auth', 'Group'),
                section(_('Regions'), 'accounts', 'Region'),
                section(_('Access Zones'), 'access_cards', 'AccessZone'),
                section(_('Transitions'), 'transitions', 'TransitionModel'),
                section(_('Report template'), 'reports', 'Report'),
                section(_('Custom fields'), 'custom_fields', 'CustomField'),
                section(_('Warehouses'), 'back_office', 'warehouse'),
                section(
                    _('Office Infrastructures'),
                    'back_office',
                    'officeinfrastructure'
                ),
            ]
        )
    ])
]

register_i18n_trees(['ralph_admin'])
Example #11
0
 def __init__(self):
     register_i18n_trees(['main'])
Example #12
0
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
from PersonalPage.views import index, game

urlpatterns = i18n_patterns(
    url(r'^$', index, name='home'),
    url(r'^game/$', game, name='game'),
    url(r'^projects/', include('projects.urls', namespace='projects')),
    url(r'^entries/', include('entries.urls', namespace='entries')),
    url(r'^games/', include('games.urls', namespace='games')),
    url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

from sitetree.sitetreeapp import register_i18n_trees
register_i18n_trees(['main'])
Example #13
0
        url(r'^__debug__/', include(debug_toolbar.urls)),
    )

    from django.contrib.staticfiles.views import serve
    urlpatterns.append(
        url(r'^static/(?P<path>.*)$', serve)
    )

urlpatterns += i18n_patterns(

    re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),

    url(r'^admin/', admin.site.urls, name='admin'),
    url(r'concerts', include('pykapela.events.urls')),
    url(r'^concerts/', include('pykapela.events.urls')),

    url(r'^gallery/(?P<slug>[\-\d\w]+)/$',
        GalleryDetailView.as_view(), name='gallery_detail'),
    url(r'^gallery/$', GalleryView.as_view(), name='gallery'),
    url(r'^gallery/photo/(?P<slug>[\-\d\w]+)/$', PhotoView.as_view(), name='photo'),
    re_path(r'^photologue/', include('photologue.urls', namespace='photologue')),

    url(r'^$', views.WebView.as_view(), name='index'),
    url(r'^(?P<slug>.*)/$', PageView.as_view(), name='pages'),
    prefix_default_language=settings.PREFIX_DEFAULT_LANGUAGE,
)

handler404 = 'pykapela.pages.views.not_found_view'

register_i18n_trees(['main_menu'])
Example #14
0
 def ready(self):
     from sitetree.sitetreeapp import register_i18n_trees
     register_i18n_trees(['main', 'pages'])
Example #15
0
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from auth_app import views as auth_views
from django.conf import settings
from django.conf.urls.static import static
from sitetree.sitetreeapp import register_i18n_trees

register_i18n_trees(['website', ])

urlpatterns = [
    path('', include('main_app.urls', namespace='main')),
    path('auth/', include('auth_app.urls', namespace='auth')),
    path('register/', auth_views.Registration.as_view(), name='register'),
    path('admin_panel/', include('admin_app.urls', namespace='admin_panel')),
    path('admin/', admin.site.urls),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)