from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import url, include
from rest_framework import routers

from geotrek.api.mobile import views as api_mobile

router = routers.DefaultRouter()
if 'geotrek.flatpages' in settings.INSTALLED_APPS:
    router.register(r'flatpages', api_mobile.FlatPageViewSet, base_name='flatpage')
if 'geotrek.trekking' in settings.INSTALLED_APPS:
    router.register(r'treks', api_mobile.TrekViewSet, base_name='treks')
urlpatterns = [
    url(r'^$', api_mobile.SwaggerSchemaView.as_view(), name="schema"),
    url(r'^', include(router.urls)),
]
if 'geotrek.flatpages' and 'geotrek.trekking' and 'geotrek.tourism':
    urlpatterns += url(r'^settings/$', api_mobile.SettingsView.as_view(), name='settings'),

from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import url, include
from rest_framework import routers


if 'geotrek.flatpages' and 'geotrek.trekking' and 'geotrek.tourism':
    from geotrek.api.mobile import views as api_mobile
    router = routers.DefaultRouter()
    urlpatterns = [
        url(r'^$', api_mobile.SwaggerSchemaView.as_view(), name="schema"),
        url(r'^', include(router.urls)),
    ]
    urlpatterns += url(r'^settings/$', api_mobile.SettingsView.as_view(), name='settings'),

if 'geotrek.flatpages' in settings.INSTALLED_APPS:
    router.register(r'flatpages', api_mobile.FlatPageViewSet, base_name='flatpage')
if 'geotrek.trekking' in settings.INSTALLED_APPS:
    router.register(r'treks', api_mobile.TrekViewSet, base_name='treks')

Fix api mobile only with geotrek flatpages trekking tourism
Fix api mobile only with geotrek flatpages trekking tourism

  from __future__ import unicode_literals
  
  from django.conf import settings
  from django.conf.urls import url, include
  from rest_framework import routers
  
- from geotrek.api.mobile import views as api_mobile
  
+ if 'geotrek.flatpages' and 'geotrek.trekking' and 'geotrek.tourism':
+     from geotrek.api.mobile import views as api_mobile
- router = routers.DefaultRouter()
+     router = routers.DefaultRouter()
+     urlpatterns = [
+         url(r'^$', api_mobile.SwaggerSchemaView.as_view(), name="schema"),
+         url(r'^', include(router.urls)),
+     ]
+     urlpatterns += url(r'^settings/$', api_mobile.SettingsView.as_view(), name='settings'),
+ 
  if 'geotrek.flatpages' in settings.INSTALLED_APPS:
      router.register(r'flatpages', api_mobile.FlatPageViewSet, base_name='flatpage')
  if 'geotrek.trekking' in settings.INSTALLED_APPS:
      router.register(r'treks', api_mobile.TrekViewSet, base_name='treks')
- urlpatterns = [
-     url(r'^$', api_mobile.SwaggerSchemaView.as_view(), name="schema"),
-     url(r'^', include(router.urls)),
- ]
- if 'geotrek.flatpages' and 'geotrek.trekking' and 'geotrek.tourism':
-     urlpatterns += url(r'^settings/$', api_mobile.SettingsView.as_view(), name='settings'),
  
Fix api mobile only with geotrek flatpages trekking tourism
## Code Before:
from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import url, include
from rest_framework import routers

from geotrek.api.mobile import views as api_mobile

router = routers.DefaultRouter()
if 'geotrek.flatpages' in settings.INSTALLED_APPS:
    router.register(r'flatpages', api_mobile.FlatPageViewSet, base_name='flatpage')
if 'geotrek.trekking' in settings.INSTALLED_APPS:
    router.register(r'treks', api_mobile.TrekViewSet, base_name='treks')
urlpatterns = [
    url(r'^$', api_mobile.SwaggerSchemaView.as_view(), name="schema"),
    url(r'^', include(router.urls)),
]
if 'geotrek.flatpages' and 'geotrek.trekking' and 'geotrek.tourism':
    urlpatterns += url(r'^settings/$', api_mobile.SettingsView.as_view(), name='settings'),

## Instruction:
Fix api mobile only with geotrek flatpages trekking tourism
## Code After:
from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import url, include
from rest_framework import routers


if 'geotrek.flatpages' and 'geotrek.trekking' and 'geotrek.tourism':
    from geotrek.api.mobile import views as api_mobile
    router = routers.DefaultRouter()
    urlpatterns = [
        url(r'^$', api_mobile.SwaggerSchemaView.as_view(), name="schema"),
        url(r'^', include(router.urls)),
    ]
    urlpatterns += url(r'^settings/$', api_mobile.SettingsView.as_view(), name='settings'),

if 'geotrek.flatpages' in settings.INSTALLED_APPS:
    router.register(r'flatpages', api_mobile.FlatPageViewSet, base_name='flatpage')
if 'geotrek.trekking' in settings.INSTALLED_APPS:
    router.register(r'treks', api_mobile.TrekViewSet, base_name='treks')
