Skip to content
Prev Previous commit
Next Next commit
Revert demo app
  • Loading branch information
Emmanouil Konstantinidis committed Jan 6, 2016
commit c3e14a6ad81c68c3cedfee177a565f6ee1fb5bdd
15 changes: 3 additions & 12 deletions demo/project/organisations/urls.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import django
from django.conf.urls import url
from project.organisations import views


organisations_urlpatterns = [
urlpatterns = [

url(r'^create/$', view=views.CreateOrganisationView.as_view(), name="create"),
url(r'^(?P<slug>[\w-]+)/members/$', view=views.OrganisationMembersView.as_view(), name="members"),
url(r'^(?P<slug>[\w-]+)/leave/$', view=views.LeaveOrganisationView.as_view(), name="leave")
]

members_urlpatterns = [
url(r'^(?P<slug>[\w-]+)/members/$', view=views.OrganisationMembersView.as_view(), name="members"),
]

# Django 1.9 Support for the app_name argument is deprecated
# https://docs.djangoproject.com/en/1.9/ref/urls/#include
django_version = django.VERSION
if django.VERSION[:2] >= (1, 9, ):
organisations_urlpatterns = (organisations_urlpatterns, 'organisations_app', )
members_urlpatterns = (members_urlpatterns, 'organisations_app', )
4 changes: 1 addition & 3 deletions demo/project/settings.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""
Django settings for demo project.

Generated by 'django-admin startproject' using Django 1.8.7.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
Expand Down Expand Up @@ -43,6 +40,7 @@

'project.accounts',
'project.organisations',

)

MIDDLEWARE_CLASSES = (
Expand Down
18 changes: 1 addition & 17 deletions demo/project/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""demo URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Expand All @@ -13,29 +12,14 @@
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
import django
from django.conf.urls import include, url
from django.contrib import admin
from .organisations.urls import organisations_urlpatterns, members_urlpatterns

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^docs/', include('rest_framework_docs.urls')),

# API
url(r'^accounts/', view=include('project.accounts.urls', namespace='accounts')),
url(r'^organisations/', view=include('project.organisations.urls', namespace='organisations')),
]

# Django 1.9 Support for the app_name argument is deprecated
# https://docs.djangoproject.com/en/1.9/ref/urls/#include
django_version = django.VERSION
if django.VERSION[:2] >= (1, 9, ):
urlpatterns.extend([
url(r'^organisations/', view=include(organisations_urlpatterns, namespace='organisations')),
url(r'^members/', view=include(members_urlpatterns, namespace='members')),
])
else:
urlpatterns.extend([
url(r'^organisations/', view=include(organisations_urlpatterns, namespace='organisations', app_name='organisations_app')),
url(r'^members/', view=include(members_urlpatterns, namespace='members', app_name='organisations_app')),
])