def register(self, app, root_patterns=None, group_patterns=None, api_patterns=None, url_app_name_override=None): with self.lock: try: app_name = app_registry.get_name(app) except KeyError: raise ImproperlyConfigured( 'You need to register the app "%s" ' 'before you can use it to build URLs.' % app) if app in self._apps: return self._apps.add(app) # group patterns are added for each group model, using the url key of the group model, # setting to the group base url of that model, # and modifying the URL pattern name with the registered group model prefix! if group_patterns: url_app_name = url_app_name_override or app_name patterns_copy = [] for url_key in group_model_registry: url_base = r'^%s/(?P<group>[^/]+)/%s/' % (url_key, url_app_name) for patt in group_patterns: patterns_copy.append( url(url_base + patt._regex[1:], patt._callback_str or patt._callback, patt.default_args, name=group_model_registry.get_url_name_prefix( url_key, '') + patt.name)) self._urlpatterns += patterns( '', url( '', include(patterns_copy, namespace=app_name, app_name=app)), ) if root_patterns: self._urlpatterns += patterns('', url(r'', include(root_patterns))) if api_patterns: self._api_urlpatterns += patterns( '', url( r'^', include(api_patterns, namespace=app_name, app_name=app)), )
url(r'^fb-integration/remove-facebook/$', 'facebook_integration.remove_facebook_association', name='facebook-remove-association'), url(r'^fb-integration/confirm-page-admin/(?P<group_id>\d+)/$', 'facebook_integration.confirm_page_admin', name='facebook-confirm-page-admin'), ) if settings.COSINNUS_IDEAS_ENABLED: urlpatterns += patterns('cosinnus.views', url(r'^ideas/$', 'map.tile_view', name='idea-list', kwargs={'types': ['ideas']}), url(r'^ideas/mine/$', 'map.tile_view', name='idea-list-mine', kwargs={'types': ['ideas'], 'show_mine': True}), url(r'^ideas/add/$', 'idea.idea_create', name='idea-create'), url(r'^ideas/(?P<slug>[^/]+)/edit/$', 'idea.idea_edit', name='idea-edit'), url(r'^ideas/(?P<slug>[^/]+)/delete/$', 'idea.idea_delete', name='idea-delete'), ) for url_key in group_model_registry: plural_url_key = group_model_registry.get_plural_url_key(url_key, url_key + '_s') prefix = group_model_registry.get_url_name_prefix(url_key, '') urlpatterns += patterns('cosinnus.views', url(r'^%s/in-group-with/(?P<group>[^/]+)/$' % plural_url_key, 'group.group_list_filtered', name=prefix+'group-list-filtered'), url(r'^%s/invited/$' % plural_url_key, 'group.group_list_invited', name=prefix+'group-list-invited'), #url(r'^%s/map/$' % plural_url_key, 'group.group_list_map', name=prefix+'group-list-map'), url(r'^%s/add/$' % plural_url_key, 'group.group_create', name=prefix+'group-add'), url(r'^%s/(?P<group>[^/]+)/$' % url_key, 'group.group_startpage', name=prefix+'group-dashboard'), url(r'^%s/(?P<group>[^/]+)/microsite/$' % url_key, 'microsite.group_microsite_view', name=prefix+'group-microsite'), #url(r'^%s/(?P<group>[^/]+)/_microsite__old_/$' % url_key, 'cms.group_microsite', name=prefix+'group-microsite'), #url(r'^%s/(?P<group>[^/]+)/_microsite__old_/edit/$' % url_key, 'cms.group_microsite_edit', name=prefix+'group-microsite-edit'), url(r'^%s/(?P<group>[^/]+)/members/$' % url_key, 'group.group_detail', name=prefix+'group-detail'), url(r'^%s/(?P<group>[^/]+)/members/recruit/$' % url_key, 'group.group_user_recruit', name=prefix+'group-user-recruit'), url(r'^%s/(?P<group>[^/]+)/members/recruitdelete/(?P<id>\d+)/$' % url_key, 'group.group_user_recruit_delete', name=prefix+'group-user-recruit-delete'), #url(r'^%s/(?P<group>[^/]+)/members/map/$' % url_key, 'group.group_members_map', name=prefix+'group-members-map'), url(r'^%s/(?P<group>[^/]+)/edit/$' % url_key, 'group.group_update', name=prefix+'group-edit'),