diff --git a/src/ralph/lib/custom_fields/tests/models.py b/src/ralph/lib/custom_fields/tests/models.py index 689665d398..eb5f3eaf6f 100644 --- a/src/ralph/lib/custom_fields/tests/models.py +++ b/src/ralph/lib/custom_fields/tests/models.py @@ -10,13 +10,13 @@ class SomeModel(WithCustomFieldsMixin, models.Model): def get_absolute_url(self): return reverse( - 'admin:{}_{}_change'.format( + 'cf_admin:{}_{}_change'.format( self._meta.app_label, self._meta.model_name ), args=(self.pk,) ) @classmethod def get_add_url(self): - return reverse('admin:{}_{}_add'.format( + return reverse('cf_admin:{}_{}_add'.format( self._meta.app_label, self._meta.model_name )) diff --git a/src/ralph/lib/custom_fields/tests/urls.py b/src/ralph/lib/custom_fields/tests/urls.py index 02a4e6106d..84686c735c 100644 --- a/src/ralph/lib/custom_fields/tests/urls.py +++ b/src/ralph/lib/custom_fields/tests/urls.py @@ -2,9 +2,7 @@ from . import admin, api -cf_tests_urls, cf_tests_app_name, cf_tests_namespace = admin.site.urls -import ipdb; ipdb.set_trace() urlpatterns = [ - url(r'^cf_tests_admin/', include((cf_tests_urls, 'ralph', 'admin'))), + url(r'^cf_tests_admin/', include(admin.site.urls)), url(r'^cf_test_api/', include(api.urlpatterns)) ] diff --git a/src/ralph/urls/base.py b/src/ralph/urls/base.py index dc6ecc85a7..49ed831dc0 100644 --- a/src/ralph/urls/base.py +++ b/src/ralph/urls/base.py @@ -29,10 +29,9 @@ # api views are registered in router) api_urls += [url(r'^', include(router.urls))] -ralph_urls, ralph_app_name, ralph_namespace = admin.urls urlpatterns = [ # override app_name (admin) with ralph (mainly for sitetree) - url(r'^', include((ralph_urls, 'ralph', ralph_namespace))), + url(r'^', include(admin.urls)), url(r'^api/', include(api_urls)), url(r'^api-token-auth/', views.obtain_auth_token), url(r'^', include('ralph.dc_view.urls.ui')), @@ -48,3 +47,10 @@ if getattr(settings, 'ENABLE_HERMES_INTEGRATION', False): urlpatterns += url(r'^hermes/', include('pyhermes.apps.django.urls')), + + +# monkey patch for sitetree until +# https://github.com/idlesign/django-sitetree/issues/226 will be discussed +# and resolved +from sitetree.sitetreeapp import SiteTree # noqa +SiteTree.current_app_is_admin = lambda self: False