Exemplo n.º 1
0
def get_router():
    router = IndexedRouter(trailing_slash=False)

    for namespace, view in APPLICATION:
        router.register(namespace, view, base_name=namespace)
        view.namespace = namespace

    return router
Exemplo n.º 2
0
from django.conf.urls import patterns, url, include
from django.views.generic import TemplateView
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from rest2backbone.forms import FormFactory
from rest2backbone.resources import IndexedRouter
from rest_framework_nested import routers
from rest2backbone.views import restApi
from crm import views

admin.autodiscover()

router = IndexedRouter(trailing_slash=False)
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'contacts', views.ContactViewSet)
router.register(r'contactevents', views.ContactEventViewSet)

events_router = routers.NestedSimpleRouter(router, r'contacts', lookup='contact')
events_router.register(r'events', views.ContactEventViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browseable API.
urlpatterns = patterns('',
    url(r'^/?$', login_required(TemplateView.as_view(template_name='crm/index.html')), {'forms': FormFactory(router)}, name='index'),
    url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'crm/login.html'}),
    url(r'^logout/$', 'django.contrib.auth.views.logout_then_login', name='logout'),
    url(r'^api/', include(router.urls)),
    url(r'^api/', include(events_router.urls)),
    url(r'^js-locale/(?P<packages>\S+?)/?$', 'django.views.i18n.javascript_catalog'),
    url(r'^js-restAPI/?$', restApi.as_view(), {'router': router, 'url_prefix':'/api'}, name='rest-api'),
Exemplo n.º 3
0
from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.views.generic.base import TemplateView
admin.autodiscover()

from sample_app.resources import AuthorView, BookView, PublisherView
from rest2backbone.resources import IndexedRouter
router=IndexedRouter(trailing_slash=False)
router.register('author', AuthorView)
router.register('book', BookView)
router.register('publisher', PublisherView)

from rest2backbone.views import restApi
from rest2backbone.forms import FormFactory

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'rest2backbone.views.home', name='home'),
    # url(r'^rest2backbone/', include('rest2backbone.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
     url(r'^/?$', TemplateView.as_view(template_name='sample/app.html'), {'forms': FormFactory(router)}),
     url(r'^js-locale/(?P<packages>\S+?)/?$', 'django.views.i18n.javascript_catalog'),
     url(r'^js-restAPI/?$', restApi.as_view(), {'router': router, 'url_prefix':'/api'}, name='rest-api'),
     url(r'^api/', include(router.urls)),
     url(r'^admin/', include(admin.site.urls)),
Exemplo n.º 4
0
from django.conf.urls import patterns, include, url
from django.conf.urls import *
import views
from django.views.generic import TemplateView, ListView
from models import PlacesGroup
from django.contrib.auth.decorators import login_required, permission_required
import format

from rest2backbone.resources import IndexedRouter
from resources import PlacesViewSet, GroupsViewSet, AddressesViewSet, GeocodeReverse, Geocode
from rest2backbone.views import restApi
from rest2backbone.forms import FormFactory
from myplaces.explaces import ExportView

router=IndexedRouter(trailing_slash=False)
router.register('place',PlacesViewSet )
router.register('group', GroupsViewSet )
router.register('address', AddressesViewSet)

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'mapy.views.home', name='home'),
    url(r'^api/', include(router.urls)),
    url(r'^api/geocode/?$', Geocode.as_view() ),
    url(r'^api/geocode/reverse/?$', GeocodeReverse.as_view() ),
    url(r'^import/(?P<step>\d+)/?$', 
        permission_required('myplaces.import_placesgroup', raise_exception=True)(views.upload_places), name='upload-places'),
    url(r'^map/?/(?P<group_id>\d+)/?(?P<place_id>\d+)?/?$', TemplateView.as_view(template_name='map.html')),
   
    url(r'^geojson/group/(?P<group_id>\d+)/?', views.group_geojson),