Пример #1
0
def add_narcissus_urls(urls):
    urls += patterns('',
        url(r'^dashboard/', include('narcissus.dashboard.urls')),
        url(r'^api/user/(?P<pk>[^/]+)/$', InstanceModelView.as_view(
            resource=UserResource, permissions=(SameUserOrReadOnly,),
        ), name='narcissus-user-detail'),
    )
    for name, posttype in posttypes.items():
        urls += patterns('',
            url(r'^api/%s/$' % name,
                ListOrCreateModelView.as_view(
                    resource=posttype.resource,
                    permissions=(permissions.IsUserOrIsAnonReadOnly,),
                ),
                name='narcissus-api-%s' % name),
            url(r'^api/%s/(?P<pk>[^/]+)/$' % name,
                InstanceModelView.as_view(
                    resource=posttype.resource,
                    permissions=(SameUserOrReadOnly,),
                ),
                name='narcissus-api-%s-detail' % name),
        )
    return urls
Пример #2
0
from apps.serverinfo.api import RootResource, ServerResource, ServerResourceQuery, \
    ServerInlineFormResource, AttributeResource, ServerGetInfoResource, ServerNewResource, \
    AttributesResource, getIpHelperFormsResource, getNextIpResource, IpResource, NoteResource

urlpatterns = patterns('',
                       url(r'^$', RootResource.as_view()),

                       url(r'^server/$', ListOrCreateModelView.as_view(resource=ServerResource), name='server-resource'),
                       url(r'^server/get/', ServerGetInfoResource.as_view()),
                       url(r'^server/new/', ServerNewResource.as_view()),
                       url(r'^server/datatables/', ServerResourceQuery.as_view()),
                       url(r'^server/inlineForm/', ServerInlineFormResource.as_view()),
                       url(r'^server/attribute/', AttributeResource.as_view()),
                       url(r'^server/ip/', IpResource.as_view()),
                       url(r'^server/note/', NoteResource.as_view()),
                       url(r'^server/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=ServerResource)),

                       url(r'^attributes/$', ListOrCreateModelView.as_view(resource=AttributesResource), name='attributes-resource'),
                       url(r'^attributes/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=AttributesResource)),
                       url(r'^getIpHelperForms/$', getIpHelperFormsResource.as_view()),
                       url(r'^getIpHelperNext/$', getNextIpResource.as_view()),
                       )

# Static views served by the rest framework itself
urlpatterns += patterns('djangorestframework.utils.staticviews',
                           (r'robots.txt', 'deny_robots'),
                           (r'favicon.ico', 'favicon'),
                           (r'^accounts/login/$', 'api_login'),
                           (r'^accounts/logout/$', 'api_logout'),
)
Пример #3
0
from django.conf.urls import patterns, include, url
from djangorestframework.views import InstanceModelView, ListOrCreateModelView
from basicapi import resources as rs
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    url(r'^horses/?$', ListOrCreateModelView.as_view(resource=rs.HorseResource), name='horse_instance'),
    url(r'^horses/(?P<id>\d+)/?$', InstanceModelView.as_view(resource=rs.HorseResource), name='horse_instance'),
    url(r'^restframework', include('djangorestframework.urls', namespace='djangorestframework'))
    # url(r'^simpleapi/', include('simpleapi.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'^admin/', include(admin.site.urls)),
)
Пример #4
0
# (c) Nelen & Schuurmans.  GPL licensed, see LICENSE.txt.
# from django.conf.urls.defaults import include
from django.conf.urls.defaults import patterns
from django.conf.urls.defaults import url
from django.contrib import admin

from djangorestframework.views import InstanceModelView

from lizard_geo.api.resources import GeoObjectGroupResource

from lizard_geo.api.views import RootView


admin.autodiscover()

NAME_PREFIX = 'lizard_geo_api_'

urlpatterns = patterns(
    '',
    url(r'^$',
        RootView.as_view(),
        name=NAME_PREFIX + 'root'),
    url(r'^geo_object_group/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=GeoObjectGroupResource),
        name=NAME_PREFIX + 'geo_object_group'),
    )
Пример #5
0
    url(r'^query/$', QueryRoot.as_view(
            permissions=(permissions.IsUserOrIsAnonReadOnly,)),
        name='decision-query'),

    url(r'^dump/$', DumpRoot.as_view(
            permissions=(permissions.IsUserOrIsAnonReadOnly,)),
        name='dump-rule'),

    url(r'^apply/$', ApplyRoot.as_view(
            permissions=(permissions.IsUserOrIsAnonReadOnly,)),
        name='apply-rule'),

    url(r'^description/(?P<pk>[0-9]+)/$', \
            InstanceModelView.as_view(
                resource=DescriptionResource,
                permissions=(permissions.IsUserOrIsAnonReadOnly,)),
        ),
    url(r'^description/$', \
            ListOrCreateModelView.as_view(
                resource=DescriptionResource,
                permissions=(permissions.IsUserOrIsAnonReadOnly,)),
        ),

    url(r'^token/(?P<pk>[0-9]+)/$', \
            InstanceModelView.as_view(
                resource=TokenResource,
                permissions=(permissions.IsUserOrIsAnonReadOnly,)),
        ),
    url(r'^token/$', \
            ListOrCreateModelView.as_view(
Пример #6
0
from scheduler.views import Todo
from views import *

class BackupTaskResource(ModelResource):
    model = BackupTask

class BackupsTodo(Todo):
    queryset = BackupTask.objects.all()

class TSMBackupsTodo(BackupsTodo):
    queryset = TSMBackupTask.objects.all()

class R1BackupsTodo(BackupsTodo):
    queryset = R1BackupTask.objects.all()

urlpatterns = patterns('',
    url(r'^$', ListOrCreateModelView.as_view(resource=BackupTaskResource)),
    url(r'^tsm/hosts/$', TSMHostsView.as_view(), name='tsm-hosts'), 
    url(r'^r1/todo/$', R1BackupsTodo.as_view(), name='r1-backups-todo'), 
    url(r'^todo/$', BackupsTodo.as_view(), name='backups-todo'), 
    url(r'^backupfilechecker/$', BackupFileCheckerView.as_view(), name='backup-file-checker'),
    url(r'^filesToCompress$', FilesToCompressView.as_view(), name='backup-files-to-compress'),
    url(r'^filesToDelete$', FilesToDeleteView.as_view(), name='backup-files-to-delete'),
    url(r'^addBackupFile$', add_backup_file, name="addBackupFile"),
    url(r'^BackupFileInfo$', GetBackupFileInfo.as_view(), name="BackupFileInfo"),
    url(r'^addWindowsBackupFile$', add_backup_file, { 'windows':True }, name="addWindowsBackupFile"),
    url(r'^registerFileFromChecker$', register_file_from_checker, name="register_file_from_checker"),
    url(r'^addCompressedBackupFile$', add_compressed_backup_file, name="addCompressedBackupFile"),
    url(r'^(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=BackupTaskResource)),
)
Пример #7
0
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from djangorestframework.permissions import IsUserOrIsAnonReadOnly
from api.resources import AllPetitionsResource, PetitionResource, SignatureResource

from api.views import HomeView

urlpatterns = patterns('',
    # Examples:
    url(r'^$', HomeView.as_view(), name='home'),
    # url(r'^WeThePeopleApi/', include('WeThePeopleApi.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'^admin/', include(admin.site.urls)),
    
    # Example for API app
    # url(r'^objects/$', ListOrCreateModelView.as_view(resource=ObjectResource), name='object-root'),
    # url(r'^objects/(?P<id>[^/]+)/$', InstanceModelView.as_view(resource=ObjectResource), name='object'),

    # Make read-only unless admin
    #class permissions.IsUserOrIsAnonReadOnly(VIEW??)
    # Petitions and Signatures API urls
    url(r'^petitions/$', ListOrCreateModelView.as_view(resource=AllPetitionsResource), name='petitions'),
    url(r'^petitions/(?P<pid>[^/]+)/$', InstanceModelView.as_view(resource=PetitionResource), name='petition'),
    url(r'^petitions/(?P<petition>[^/]+)/signatures/$', ListOrCreateModelView.as_view(resource=SignatureResource), name='signatures'),
    url(r'^petitions/(?P<petition>[^/]+)/signatures/(?P<sig_num>[^/]+)/$', InstanceModelView.as_view(resource=SignatureResource), name='signature'),
)
Пример #8
0
from django.conf.urls.defaults import patterns, url
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from modelresourceexample.resources import MyModelResource

urlpatterns = patterns('',
    url(r'^$',          ListOrCreateModelView.as_view(resource=MyModelResource), name='model-resource-root'),
    url(r'^(?P<pk>[0-9]+)/$', InstanceModelView.as_view(resource=MyModelResource)),
)
Пример #9
0
from django.conf.urls import patterns, include, url
from django.views.generic import DetailView, ListView

from djangorestframework.resources import ModelResource
from djangorestframework.views import ListOrCreateModelView, InstanceModelView

from environment.models import Estatistica


class EstatisticaResource(ModelResource):
    model = Estatistica


urlpatterns = patterns(
    '',
    url(r'^rest/environment/$',
        ListOrCreateModelView.as_view(resource=EstatisticaResource)),
    url(r'^rest/environment/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=EstatisticaResource)),
)
Пример #10
0
urlpatterns = patterns(
    '',
    url(r'^$', RootResource.as_view()),
    url(r'^server/$',
        ListOrCreateModelView.as_view(resource=ServerResource),
        name='server-resource'),
    url(r'^server/get/', ServerGetInfoResource.as_view()),
    url(r'^server/new/', ServerNewResource.as_view()),
    url(r'^server/datatables/', ServerResourceQuery.as_view()),
    url(r'^server/inlineForm/', ServerInlineFormResource.as_view()),
    url(r'^server/attribute/', AttributeResource.as_view()),
    url(r'^server/ip/', IpResource.as_view()),
    url(r'^server/note/', NoteResource.as_view()),
    url(r'^server/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=ServerResource)),
    url(r'^attributes/$',
        ListOrCreateModelView.as_view(resource=AttributesResource),
        name='attributes-resource'),
    url(r'^attributes/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=AttributesResource)),
    url(r'^getIpHelperForms/$', getIpHelperFormsResource.as_view()),
    url(r'^getIpHelperNext/$', getNextIpResource.as_view()),
)

# Static views served by the rest framework itself
urlpatterns += patterns(
    'djangorestframework.utils.staticviews',
    (r'robots.txt', 'deny_robots'),
    (r'favicon.ico', 'favicon'),
    (r'^accounts/login/$', 'api_login'),
Пример #11
0
        name='send_unpaid_reports'),
    url(r'^admin/send_unpaid_reminders/*(?P<type>[\w]*)/*(?P<donation_id>[\d]*)$',
        'husky.views.send_unpaid_reminders',
        name='send_unpaid_reminders'),

    # admin
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),

    # REST API
    url(r'^REST/api-auth/',
        include('djangorestframework.urls', namespace='djangorestframework')),
    url(r'^REST/teacher/$',
        ListOrCreateModelView.as_view(resource=TeacherResource)),
    url(r'^REST/teacher/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=TeacherResource)),
    url(r'^REST/grade/$',
        ListOrCreateModelView.as_view(resource=GradeResource)),
    url(r'^REST/grade/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=GradeResource)),
    url(r'^REST/parent/$',
        ListOrCreateModelView.as_view(resource=ParentResource)),
    url(r'^REST/parent/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=ParentResource)),
    url(r'^REST/children/$',
        ListOrCreateModelView.as_view(resource=ChildrenResource)),
    url(r'^REST/children/(?P<identifier>[^/]+)/$',
        InstanceModelView.as_view(resource=ChildrenResource)),
    url(r'^REST/donation/$',
        ListOrCreateModelView.as_view(resource=DonationResource)),
    url(r'^REST/donation/(?P<pk>[^/]+)/$',
Пример #12
0
from django.conf.urls.defaults import patterns, url

from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from apps.todos.resources import TodoResource

my_model_list = ListOrCreateModelView.as_view(resource=TodoResource)
my_model_instance = InstanceModelView.as_view(resource=TodoResource)

urlpatterns = patterns(
    '',
    url(r'^todos/$', my_model_list, name='todos_api_root'),
    url(r'^todos/(?P<id>[0-9]+)$',
        my_model_instance,
        name='todos_api_instance'),
)
Пример #13
0
from djangorestframework.resources import ModelResource
from djangorestframework.views import ListOrCreateModelView, InstanceModelView

from models import Task, TaskCheck
from views import Todo, TaskStatusView


class TaskResource(ModelResource):
    model = Task


class TaskCheckResource(ModelResource):
    model = TaskCheck


urlpatterns = patterns(
    '',
    url(r'^$', ListOrCreateModelView.as_view(resource=TaskResource)),
    url(r'^taskchecks/$',
        ListOrCreateModelView.as_view(resource=TaskCheckResource)),
    url(r'^taskstatus/$',
        TaskStatusView.as_view(), {'task': None},
        name='taskstatus'),
    url(r'^taskstatus/(?P<task>[^/]+)/$',
        TaskStatusView.as_view(),
        name='taskstatus'),
    url(r'^todo/$', Todo.as_view(), name='tasks-todo'),
    url(r'^(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=TaskCheckResource)),
)
Пример #14
0
class UserForm(ModelForm):
    class Meta:
        model = User
        exclude = ('last_login', 'date_joined')

class UserResource(ModelResource):
    model = User
    form = UserForm
    
class CustomUserResource(ModelResource):
    model = CustomUser    

urlpatterns = patterns('',
    url(r'^users/$', ListOrCreateModelView.as_view(resource=UserResource), name='users'),
    url(r'^users/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=UserResource)),
    url(r'^customusers/$', ListOrCreateModelView.as_view(resource=CustomUserResource), name='customusers'),
    url(r'^customusers/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=CustomUserResource)),
    url(r'^groups/$', ListOrCreateModelView.as_view(resource=GroupResource), name='groups'),
    url(r'^groups/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=GroupResource)),
)


class ModelViewTests(TestModelsTestCase):
    """Test the model views djangorestframework provides"""
    urls = 'djangorestframework.tests.modelviews'  

    def test_creation(self):
        """Ensure that a model object can be created"""
        self.assertEqual(0, Group.objects.count())
Пример #15
0
#-*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from .resources import ApplicationResource

urlpatterns = patterns('',
    url(r'^applications/$',          ListOrCreateModelView.as_view(resource=ApplicationResource), name='application-resource-root'),
    url(r'^applications/(?P<name>[a-z0-9_]+)/$', InstanceModelView.as_view(resource=ApplicationResource)),
)
Пример #16
0
from django.conf.urls.defaults import patterns, url

from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from .resources import ColorResource

urlpatterns = patterns('',
    url(r'^colors/$',
        ListOrCreateModelView.as_view(resource=ColorResource),
        name='todo-resources'),
    url(r'^colors/(?P<pk>[0-9]+)$',
        InstanceModelView.as_view(resource=ColorResource)),
)

Пример #17
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from wic.views import *
from djangorestframework.views import ListModelView, InstanceModelView
from wic.resources import *
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^news/(?P<slug>[^\.]+)', 'wic.views.view_article' , name='view_article'),
    url(r'^live/$', 'wic.views.gigs_index' ),
    url(r'^live/previous/$', 'wic.views.gigs_old' ),
    url(r'^gigs/(?P<slug>[^\.]+)', 'wic.views.view_gig' , name='view_gig'),
    url(r'^media/photos/$', 'wic.views.media_photos' ),
    url(r'^media/discography/$', 'wic.views.media_discography' ),
    url(r'^media/videos/$', 'wic.views.media_videos' ),
    url(r'^band/$', 'wic.views.band_index' ),
    url(r'^contact/$', 'wic.views.contact' ),
    url(r'^thanks/$', 'django.views.generic.simple.direct_to_template', {'template': 'contact-thanks.html'}),
    url(r'^$', 'wic.views.main_index' ),
    url(r'^api/devices/$', AuthenticatedListOrCreateModelView.as_view(resource=DeviceTokensResource)),
    url(r'^api/live/$', ListModelView.as_view(resource=GigsResource)),
    url(r'^api/photos/$', ListModelView.as_view(resource=PhotosResource)),
    url(r'^api/discography/$', ListModelView.as_view(resource=DiscographyResource)),
    url(r'^api/members/$', ListModelView.as_view(resource=MembersResource)),
    url(r'^api/news/$', ListModelView.as_view(resource=NewsResource)),
    url(r'^api/news/(?P<slug>[^\.]+)/$', InstanceModelView.as_view(resource=NewsResource)),
    url(r'^api/albums/$', ListModelView.as_view(resource=AlbumsResource)),
)
Пример #18
0
    '',
    url(r'^$', ListOrCreateModelView.as_view(resource=BackupTaskResource)),
    url(r'^tsm/todo/$', TSMBackupsTodo.as_view(), name='tsm-backups-todo'),
    url(r'^r1/todo/$', R1BackupsTodo.as_view(), name='r1-backups-todo'),
    url(r'^todo/$', BackupsTodo.as_view(), name='backups-todo'),
    url(r'^backupfilechecker/$',
        BackupFileCheckerView.as_view(),
        name='backup-file-checker'),
    url(r'^filesToCompress$',
        FilesToCompressView.as_view(),
        name='backup-files-to-compress'),
    url(r'^filesToDelete$',
        FilesToDeleteView.as_view(),
        name='backup-files-to-delete'),
    url(r'^addBackupFile$', add_backup_file, name="addBackupFile"),
    url(r'^BackupFileInfo$',
        GetBackupFileInfo.as_view(),
        name="BackupFileInfo"),
    url(r'^addWindowsBackupFile$',
        add_backup_file, {'windows': True},
        name="addWindowsBackupFile"),
    url(r'^registerFileFromChecker$',
        register_file_from_checker,
        name="register_file_from_checker"),
    url(r'^addCompressedBackupFile$',
        add_compressed_backup_file,
        name="addCompressedBackupFile"),
    url(r'^(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=BackupTaskResource)),
)
Пример #19
0
# urls.py
# =======
from graph.api import *
from django.conf.urls.defaults import patterns, url
from djangorestframework.views import ListOrCreateModelView, InstanceModelView

urlpatterns = patterns('',
    url(r'^api/person/$', ListOrCreateModelView.as_view(resource=PersonResource)),
    url(r'^api/person/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=PersonResource)),
    url(r'^api/evaluation/$', ListOrCreateModelView.as_view(resource=EvaluationResource)),
    url(r'^api/evaluation/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=EvaluationResource)),
)
Пример #20
0
from django.conf.urls.defaults import patterns, url
from djangorestframework.views import ListModelView, InstanceModelView
from freevana.resources import MovieResource, MovieSourceResource


urlpatterns = patterns('',
    url(r'^movies/$', ListModelView.as_view(resource=MovieResource), name='movie-list'),
    url(r'^movies/(?P<id>[^/]+)/$', InstanceModelView.as_view(resource=MovieResource), name='movie-detail'),
    url(r'^movies/(?P<movie>[^/]+)/sources/$',
         ListModelView.as_view(resource=MovieSourceResource), name='movie-source-list'),
    url(r'^movies/(?P<movie>[^/]+)/sources/(?P<id>[^/]+)/$',
        InstanceModelView.as_view(resource=MovieSourceResource)),
)
Пример #21
0
from django.conf.urls.defaults import patterns, url

from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from .resources import TodoResource

urlpatterns = patterns('',
    url(r'^todos/$',
        ListOrCreateModelView.as_view(resource=TodoResource),
        name='todo-resources'),
    url(r'^todos/(?P<pk>[0-9]+)/$',
        InstanceModelView.as_view(resource=TodoResource),
        name='todo-resources'),
)
Пример #22
0
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from django.contrib import admin
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from restapi.resources import *

from views import ListOrCreateUserView

handler500 = 'mainsite.views.error500'
handler404 = 'mainsite.views.error404'


urlpatterns = patterns('',

    url(r'^player/$', ListOrCreateModelView.as_view(resource=PlayerResource), name='player_list'),
    url(r'^player/(?P<player_id>[0-9]+)/$', InstanceModelView.as_view(resource=PlayerResource)),

    url(r'^user/$', ListOrCreateUserView.as_view(), name='user_list'),
    url(r'^user/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=UserResource), name='user_detail'),

    url(r'^pieceColor/$', ListOrCreateModelView.as_view(resource=PieceColorResource), name='pieceColor_list'),
    url(r'^pieceColor/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=PieceColorResource), name='pieceColor_detail'),

    url(r'^boardSetup/$', ListOrCreateModelView.as_view(resource=BoardSetupResource), name='boardSetup_list'),
    url(r'^boardSetup/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=BoardSetupResource), name='boardSetup_detail'),

    url(r'^boardSetupColor/$', ListOrCreateModelView.as_view(resource=BoardSetupColorResource), name='boardSetupColor_list'),
    url(r'^boardSetupColor/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=BoardSetupColorResource), name='boardSetupColor_detail'),

    url(r'^game/$', ListOrCreateModelView.as_view(resource=GameResource), name='game_list'),
    url(r'^game/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=GameResource), name='game_detail'),
Пример #23
0
from django.conf.urls.defaults import patterns, include, url
from resources import *
from views import *
from djangorestframework.views import ListOrCreateModelView, InstanceModelView


urlpatterns = patterns('',

    # customed view/handler
#    (r'poll/(?P<pid>[^/]+)/choice/(?P<cid>[^/]+)', RESTforPollAndChoice.as_view(resource=ChoiceItemResource)),
#    (r'poll/', RESTforPoll.as_view(resource=PollItemResource)),
                       
    # built-in view/handler
    (r'cycle/(?P<id>[^/]+)', InstanceModelView.as_view(resource=CycleItemResource)),
    (r'cycle/', ListOrCreateModelView.as_view(resource=CycleItemResource)),
    (r'package/(?P<id>[^/]+)', InstanceModelView.as_view(resource=PackageItemResource)),
    (r'package/', ListOrCreateModelView.as_view(resource=PackageItemResource)),
    (r'card/(?P<id>[^/]+)', InstanceModelView.as_view(resource=CardItemResource)),
    (r'card/', ListOrCreateModelView.as_view(resource=CardItemResource)),
)
Пример #24
0
from django.conf.urls.defaults import patterns, url, include
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from groupes.api import EleveResource, ImportationResource, ImpGroupeResource, \
    ImpGroupeDetailResource







urlpatterns = patterns( '',
    # Administration
    url( r'^admin/', include( 'uiadmin.urls' ) ),
    url( r'^groupes/', include( 'groupes.urls' ) ),
    url( r'^periodes/', include( 'periode.urls' ) ),
    url( r'^evaluations/', include( 'evaluations.urls' ) ),
                       
    # API
    url( r'^api/v4/eleves/$', ListOrCreateModelView.as_view( resource=EleveResource ) ),
    url( r'^api/v4/eleves/(?P<pk>[^/]+)/$', InstanceModelView.as_view( resource=EleveResource ) ),
    url( r'^api/v4/importations/$', ListOrCreateModelView.as_view( resource=ImportationResource ) ),
    url( r'^api/v4/importations/(?P<pk>[^/]+)/$', InstanceModelView.as_view( resource=ImportationResource ) ),
    url( r'^api/v4/importations/(?P<importation>[^/]+)/groupes/$', ListOrCreateModelView.as_view( resource=ImpGroupeResource ) ),
    url( r'^api/v4/importations/(?P<importation>[^/]+)/groupes/(?P<pk>[^/]+)/$', InstanceModelView.as_view( resource=ImpGroupeResource ) ),
    url( r'^api/v4/importations/(?P<importation>[^/]+)/groupes/(?P<pk>[^/]+)/eleves/$', InstanceModelView.as_view( resource=ImpGroupeDetailResource ), name='importation-groupes-details' ),

    
 )
Пример #25
0
from django.conf.urls import patterns, url
from djangorestframework.resources import ModelResource
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from cuba.models.accounts import UserProfile
from cuba.utils import const
from cuba.views.accounts import UserDetailView

class UserProfileResource(ModelResource):
  model = UserProfile

urlpatterns = patterns('',

  url(const.MATCH_SLUG, UserDetailView.as_view(), name='user_detail'),

  url(r'api/^$', ListOrCreateModelView.as_view(resource=UserProfileResource)),
  url(r'^%s/$' % const.MATCH_PK, InstanceModelView.as_view(resource=UserProfileResource)),
)
Пример #26
0
    #
    #    return instance
    
#class MockView(View):
#            permissions = ()
#            form = FileForm
#            def post(self, request, *args, **kwargs):
#                return {'FILE_NAME': self.CONTENT['file'].name,
#                        'FILE_CONTENT': self.CONTENT['file'].read()}

from django.core.urlresolvers import reverse

from djangorestframework.views import View
from djangorestframework.response import Response
from djangorestframework import status

from cloudport.job_manager.views import *

class ExampleView(View):
    #A basic read-only view that points to 3 other views.
    def get(self, request):
        #Handle GET requests, returning a list of URLs pointing to 3 other views.
        return repr(request.user)

urlpatterns = patterns('',
    url(r'^test/$', ExampleView.as_view(resource=Jobs, permissions=(permissions.IsAuthenticated,))),
    url(r'^job/$', ListOrCreateModelView.as_view(resource=Jobs, permissions=(permissions.IsAuthenticated,))),
    url(r'^job/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=Jobs, permissions=(permissions.IsAuthenticated,))),
    #url(r'^files/$', ListOrCreateModelView.as_view(resource=DataFiles, permissions=(permissions.IsAuthenticated,))),    
    #url(r'^files/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=DataFiles, permissions=(permissions.IsAuthenticated,))),
)
Пример #27
0
from django.conf.urls.defaults import patterns, url,include
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from resources import MyModelResource
from django.contrib import admin
from views import getProgress
from views import getProgressBarData
from views import getProgressLog
from django.conf import settings

admin.autodiscover()
my_model_list = ListOrCreateModelView.as_view(resource=MyModelResource)
my_model_instance = InstanceModelView.as_view(resource=MyModelResource)

urlpatterns = patterns('',
    url(r'^restframework', include('djangorestframework.urls', namespace='djangorestframework')),
    url(r'^$', my_model_list, name='model-resource-root'),
    url(r'^(?P<id>[0-9]+)/$', my_model_instance, name='model-resource-instance'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^getProgress/',getProgress),
    url(r'^getProgressBarData$',getProgressBarData),
    url(r'^getProgressLog/',getProgressLog),
    (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT,})
)
Пример #28
0
class UserForm(ModelForm):
    class Meta:
        model = User
        exclude = ('last_login', 'date_joined')

class UserResource(ModelResource):
    model = User
    form = UserForm
    
class CustomUserResource(ModelResource):
    model = CustomUser    

urlpatterns = patterns('',
    url(r'^users/$', ListOrCreateModelView.as_view(resource=UserResource), name='users'),
    url(r'^users/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=UserResource)),
    url(r'^customusers/$', ListOrCreateModelView.as_view(resource=CustomUserResource), name='customusers'),
    url(r'^customusers/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=CustomUserResource)),
    url(r'^groups/$', ListOrCreateModelView.as_view(resource=GroupResource), name='groups'),
    url(r'^groups/(?P<id>[0-9]+)/$', InstanceModelView.as_view(resource=GroupResource)),
)


class ModelViewTests(TestCase):
    """Test the model views djangorestframework provides"""
    urls = 'djangorestframework.tests.modelviews'  

    def test_creation(self):
        """Ensure that a model object can be created"""
        self.assertEqual(0, Group.objects.count())
Пример #29
0
    # rss feed
    url(r'^blog/feed$', BlogFeed()),

    # reports
    url(r'^admin/reporting/(?P<type>[\w-]+)$', 'husky.views.reporting', name='reporting'),
    url(r'^admin/reports/(?P<type>[\w-]+)$', 'husky.views.reports', name='reports'),
    url(r'^admin/results/(?P<type>[\w-]*)/*(?P<grade>[\w]*)$', 'husky.views.results', name='results'),
    url(r'^admin/(?P<type>[\w]+)/calculate_totals/*(?P<id>[\d]*)$', 'husky.views.calculate_totals', name='calculate_totals'),
    url(r'^admin/send_teacher_reports/*(?P<id>[\d,]*)$', 'husky.views.send_teacher_reports', name='send_teacher_reports'),
    url(r'^admin/send_unpaid_reports$', 'husky.views.send_unpaid_reports', name='send_unpaid_reports'),
    url(r'^admin/send_unpaid_reminders/*(?P<type>[\w]*)/*(?P<donation_id>[\d]*)$', 'husky.views.send_unpaid_reminders', name='send_unpaid_reminders'),

    # admin
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),

    # REST API
    url(r'^REST/api-auth/', include('djangorestframework.urls', namespace='djangorestframework')),
    url(r'^REST/teacher/$', ListOrCreateModelView.as_view(resource=TeacherResource)),
    url(r'^REST/teacher/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=TeacherResource)),
    url(r'^REST/grade/$', ListOrCreateModelView.as_view(resource=GradeResource)),
    url(r'^REST/grade/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=GradeResource)),
    url(r'^REST/parent/$', ListOrCreateModelView.as_view(resource=ParentResource)),
    url(r'^REST/parent/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=ParentResource)),
    url(r'^REST/children/$', ListOrCreateModelView.as_view(resource=ChildrenResource)),
    url(r'^REST/children/(?P<identifier>[^/]+)/$', InstanceModelView.as_view(resource=ChildrenResource)),
    url(r'^REST/donation/$', ListOrCreateModelView.as_view(resource=DonationResource)),
    url(r'^REST/donation/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=DonationResource))
)
Пример #30
0
from django.conf.urls.defaults import patterns, url

from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from apps.todos.resources import TodoResource

my_model_list = ListOrCreateModelView.as_view(resource=TodoResource)
my_model_instance = InstanceModelView.as_view(resource=TodoResource)

urlpatterns = patterns('',
    url(r'^todos/$', my_model_list, name='todos_api_root'),
    url(r'^todos/(?P<id>[0-9]+)$', my_model_instance, name='todos_api_instance'),
)
Пример #31
0
__FILENAME__ = urls
from django.conf.urls import patterns, include, url
from djangorestframework.views import InstanceModelView, ListOrCreateModelView
from basicapi import resources as rs
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns(
    '',
    # Examples:
    url(r'^horses/?$',
        ListOrCreateModelView.as_view(resource=rs.HorseResource),
        name='horse_instance'),
    url(r'^horses/(?P<id>\d+)/?$',
        InstanceModelView.as_view(resource=rs.HorseResource),
        name='horse_instance'),
    url(r'^restframework',
        include('djangorestframework.urls', namespace='djangorestframework'))
    # url(r'^simpleapi/', include('simpleapi.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'^admin/', include(admin.site.urls)),
)

########NEW FILE########
__FILENAME__ = wsgi
"""
Пример #32
0
from django.conf.urls import patterns, include, url
from djangorestframework.permissions import IsUserOrIsAnonReadOnly
from djangorestframework.views import InstanceModelView, ListOrCreateModelView, \
    ListModelView
from events.resources import ConventionResource, GameResource, PublisherResource, \
    DemandResource, UserResource
from events.views import ApiRoot, EventRoot, EventModelView, EventJoinView, \
    EventLeaveView, DemandRoot, DemandModelView, UserModelView

urlpatterns = patterns('events',
    url(r'^$', ApiRoot.as_view()),

    url(r'^publishers/$', ListOrCreateModelView.as_view(
        resource=PublisherResource, permissions=(IsUserOrIsAnonReadOnly, )),
        name='publisher-list'),
    url(r'^publishers/(?P<pk>[^/]+)/$', InstanceModelView.as_view(
        resource=PublisherResource, permissions=(IsUserOrIsAnonReadOnly, )),
        name='publisher-instance'),
    
    url(r'^games/$', ListOrCreateModelView.as_view(resource=GameResource,
        permissions=(IsUserOrIsAnonReadOnly, )), name='game-list'),
    url(r'^games/(?P<pk>[^/]+)/$', InstanceModelView.as_view(
        resource=GameResource, permissions=(IsUserOrIsAnonReadOnly, )),
        name='game-instance'),

    url(r'^conventions/$', ListOrCreateModelView.as_view(
        resource=ConventionResource, permissions=(IsUserOrIsAnonReadOnly, )),
        name='convention-list'),
    url(r'^conventions/(?P<pk>[^/]+)$', InstanceModelView.as_view(
        resource=ConventionResource, permissions=(IsUserOrIsAnonReadOnly, )),
        name='convention-instance'),
Пример #33
0

admin.autodiscover()

NAME_PREFIX = 'lizard_fewsnorm_api_'

urlpatterns = patterns(
    '',
    url(r'^$',
        RootView.as_view(),
        name=NAME_PREFIX + 'root'),
    url(r'^source/$',
        ListOrCreateModelView.as_view(resource=FewsNormSourceResource),
        name=NAME_PREFIX + 'source_list'),
    url(r'^source/(?P<slug>.*)/$',
        InstanceModelView.as_view(resource=FewsNormSourceResource),
        name=NAME_PREFIX + 'source_detail'),
    url(r'^location/$',
        LocationView.as_view(),
        name=NAME_PREFIX + 'location'),
    url(r'^identifier/$',
        IdentifierView.as_view(),
        name=NAME_PREFIX + 'identifier'),
    url(r'^location/(?P<ident>.*)/$',
        InstanceModelView.as_view(resource=LocationResource),
        name=NAME_PREFIX + 'location_detail'),
    url(r'^parameter/$',
        ParameterView.as_view(),
        name=NAME_PREFIX + 'parameter'),
    url(r'^parameter/(?P<ident>.*)/$',
        InstanceModelView.as_view(resource=ParameterResource),
Пример #34
0
        bar = models.IntegerField(help_text='Must be an integer.')
        baz = models.CharField(max_length=32,
                               help_text='Free text.  Max length 32 chars.')

    model = MockResourceModel
    fields = ('foo', 'bar', 'baz')


urlpatterns = patterns(
    '',
    url(r'^mock/$', MockView.as_view()),
    url(r'^mock/final/$', MockViewFinal.as_view()),
    url(r'^resourcemock/$', ResourceMockView.as_view()),
    url(r'^model/$', ListOrCreateModelView.as_view(resource=MockResource)),
    url(r'^model/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=MockResource)),
    url(r'^restframework/',
        include('djangorestframework.urls', namespace='djangorestframework')),
)


class BaseViewTests(TestCase):
    """Test the base view class of djangorestframework"""
    urls = 'djangorestframework.tests.views'

    def test_view_call_final(self):
        response = self.client.options('/mock/final/')
        self.assertEqual(response['Content-Type'].split(';')[0],
                         "application/json")
        parser = JSONParser(None)
        (data, files) = parser.parse(
Пример #35
0
  ThreadInstanceView.as_view(resource=ThreadResource)),
 (r"^thread/(?P<section__slug>\w+)/(?P<id>\d+)$",
  ThreadInstanceView.as_view(resource=ThreadResource)),
 (r"^post/$", PostListOrCreateView.as_view(resource=PostResource)),
 (r"^post/(?P<thread__section__slug>\w+)/$",
  PostListOrCreateView.as_view(resource=PostResource)),
 (r"^post/(?P<thread__section__slug>\w+)/first/$",
  PostListOrCreateView.as_view(resource=PostResource), {
      "is_op_post": True
  }),
 (r"^post/(?P<id>\d+)$", PostInstanceView.as_view(resource=PostResource)),
 (r"^post/(?P<thread__section__slug>\w+)/(?P<pid>\d+)$",
  PostInstanceView.as_view(resource=PostResource)),
 (r"^section/$", ListOrCreateModelView.as_view(resource=SectionResource)),
 (r"^section/(?P<id>\d+)$",
  InstanceModelView.as_view(resource=SectionResource)),
 (r"^section/(?P<slug>\w+)",
  InstanceModelView.as_view(resource=SectionResource)),
 (r"^sectiongroup/",
  ListOrCreateModelView.as_view(resource=SectionGroupResource)),
 (r"^sectiongroup/(?P<id>\d+)",
  InstanceModelView.as_view(resource=SectionGroupResource)),
 (r"^file/$", ListOrCreateModelView.as_view(resource=FileResource)),
 (r"^file/(?P<id>\d+)$", FileInstanceView.as_view(resource=FileResource)),
 (r"^file/random_image/(?P<count>\d{1,2})",
  RandomImageView.as_view(resource=FileResource)),
 (r"^filetype/(?P<id>\d+)$",
  InstanceModelView.as_view(resource=FileTypeResource)),
 (r"^filetype/(?P<extension>[\w\d]+)$",
  InstanceModelView.as_view(resource=FileTypeResource)),
 (r"^filetypegroup/$",
Пример #36
0
# Uncomment the next two lines to enable the admin:
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'web.views.home', name='home'),
    # url(r'^web/', include('web.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'^admin/', include(admin.site.urls)),
    
    url(r'^rest/participants/$',                 ListOrCreateModelView.as_view(resource=ParticipantResource), name='model-resource-root'),
    url(r'^rest/participant/(?P<pk>[0-9]+)/$',   InstanceModelView.as_view(resource=ParticipantResource)),
    url(r'^rest/events/$',                       ListOrCreateModelView.as_view(resource=EventResource), name='model-resource-root'),
    url(r'^rest/event/(?P<pk>[0-9]+)/$',         InstanceModelView.as_view(resource=EventResource)),
    url(r'^rest/groups/$',                       ListOrCreateModelView.as_view(resource=GroupResource), name='model-resource-root'),
    url(r'^rest/group/(?P<pk>[0-9]+)/$',         InstanceModelView.as_view(resource=GroupResource)),
    url(r'^rest/types/$',                        ListOrCreateModelView.as_view(resource=ExpenseTypeResource), name='model-resource-root'),
    url(r'^rest/type/(?P<pk>[0-9]+)/$',          InstanceModelView.as_view(resource=ExpenseTypeResource)),
    url(r'^rest/weights/$',                      ListOrCreateModelView.as_view(resource=WeightResource), name='model-resource-root'),
    url(r'^rest/weight/(?P<pk>[0-9]+)/$',        InstanceModelView.as_view(resource=WeightResource)),
    url(r'^rest/expenses/$',                     ListOrCreateModelView.as_view(resource=ExpenseResource)),
    url(r'^rest/expense/(?P<pk>[0-9]+)/$',       InstanceModelView.as_view(resource=ExpenseResource)),
    url(r'^rest/authenticate$',                  AuthenticationView.as_view()),
    url(r'^rest/add_expense$',                   ExpenseAddView.as_view()),
    url(r'^rest/calculator$',                    CalculatorView.as_view()),
    url(r'^rest/event/(?P<pk>[0-9+])/participants$', EventParticipantsView.as_view()),
    url(r'^rest/event/(?P<pk>[0-9+])/expense_types$', EventExpenseTypesView.as_view()),
Пример #37
0
from django.conf.urls.defaults import patterns, url
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from modelresourceexample.resources import MyModelResource

my_model_list = ListOrCreateModelView.as_view(resource=MyModelResource)
my_model_instance = InstanceModelView.as_view(resource=MyModelResource)

urlpatterns = patterns(
    '',
    url(r'^$', my_model_list, name='model-resource-root'),
    url(r'^(?P<id>[0-9]+)/$',
        my_model_instance,
        name='model-resource-instance'),
)
Пример #38
0
try:
    from django.conf.urls import patterns, url
except ImportError:
    # Django < 1.4
    from django.conf.urls.defaults import patterns, url

from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from blogpost.resources import BlogPostResource, CommentResource


urlpatterns = patterns('',
    url(r'^$', ListOrCreateModelView.as_view(resource=BlogPostResource), name='blog-posts-root'),
    url(r'^(?P<key>[^/]+)/$', InstanceModelView.as_view(resource=BlogPostResource), name='blog-post'),
    url(r'^(?P<blogpost>[^/]+)/comments/$', ListOrCreateModelView.as_view(resource=CommentResource), name='comments'),
    url(r'^(?P<blogpost>[^/]+)/comments/(?P<id>[^/]+)/$', InstanceModelView.as_view(resource=CommentResource)),
)
Пример #39
0
from lizard_area.models import Area

admin.autodiscover()

NAME_PREFIX = 'lizard_area_api_'

urlpatterns = patterns(
    '',
    url(r'^$',
        RootView.as_view(),
        name=NAME_PREFIX + 'root'),
    url(r'^category/$',
        CategoryRootView.as_view(),
        name=NAME_PREFIX + 'category_root'),
    url(r'^category/(?P<slug>[^/]+)/$',
        InstanceModelView.as_view(resource=CategoryResource),
        name=NAME_PREFIX + 'category'),
    url(r'^krw-areas/$',
        AreaViewForTree.as_view(),
         {'area_classes': (Area.AREA_CLASS_KRW_WATERLICHAAM,)},
        name=NAME_PREFIX + 'krw_areas'),
    url(r'^catchment-areas/$',  # Aan-/afvoergebieden
        AreaViewForTree.as_view(),
        {'area_classes': (Area.AREA_CLASS_AAN_AFVOERGEBIED,
                          Area.AREA_CLASS_DEEL_AAN_AFVOERGEBIED,)},
        name=NAME_PREFIX + 'catchment_areas'),
    url(r'^communique/(?P<pk>[^/]+)/$',
        InstanceModelView.as_view(resource=CommuniqueResource),
        name=NAME_PREFIX + 'communique'),
    url(r'^property/$',
        AreaPropertyView.as_view(),
Пример #40
0
from django.conf.urls.defaults import patterns, include, url
from djangorestframework.views import InstanceModelView, ListOrCreateModelView
from resources import CardResource

urlpatterns = patterns('',
    url(r'^cards/?$', ListOrCreateModelView.as_view(resource=CardResource), name='card_list_or_create_model_view'),
    url(r'^cards/(?P<id>\d+)/?$', InstanceModelView.as_view(resource=CardResource), name='card_instance_model_view'),
)
Пример #41
0
        bar = models.IntegerField(help_text='Must be an integer.')
        baz = models.CharField(max_length=32, help_text='Free text.  Max length 32 chars.')

    model = MockResourceModel
    fields = ('foo', 'bar', 'baz')

urlpatterns = patterns('djangorestframework.utils.staticviews',
    url(r'^robots.txt$', 'deny_robots'),
    url(r'^favicon.ico$', 'favicon'),
    url(r'^accounts/login$', 'api_login'),
    url(r'^accounts/logout$', 'api_logout'),
    url(r'^mock/$', MockView.as_view()),
    url(r'^mock/final/$', MockViewFinal.as_view()),
    url(r'^resourcemock/$', ResourceMockView.as_view()),
    url(r'^model/$', ListOrCreateModelView.as_view(resource=MockResource)),
    url(r'^model/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=MockResource)),
)

class BaseViewTests(TestCase):
    """Test the base view class of djangorestframework"""
    urls = 'djangorestframework.tests.views'

    def test_view_call_final(self):
        response = self.client.options('/mock/final/')
        self.assertEqual(response['Content-Type'].split(';')[0], "application/json")
        parser = JSONParser(None)
        (data, files) = parser.parse(StringIO(response.content))
        self.assertEqual(data['test'], 'passed')

    def test_options_method_simple_view(self):
        response = self.client.options('/mock/')
Пример #42
0
try:
    from django.conf.urls import patterns, url
except ImportError:
    # Django < 1.4
    from django.conf.urls.defaults import patterns, url

from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from blogpost.resources import BlogPostResource, CommentResource

urlpatterns = patterns(
    '',
    url(r'^$',
        ListOrCreateModelView.as_view(resource=BlogPostResource),
        name='blog-posts-root'),
    url(r'^(?P<key>[^/]+)/$',
        InstanceModelView.as_view(resource=BlogPostResource),
        name='blog-post'),
    url(r'^(?P<blogpost>[^/]+)/comments/$',
        ListOrCreateModelView.as_view(resource=CommentResource),
        name='comments'),
    url(r'^(?P<blogpost>[^/]+)/comments/(?P<id>[^/]+)/$',
        InstanceModelView.as_view(resource=CommentResource)),
)
Пример #43
0
class UserResource(ModelResource):
    model = User
    form = UserForm


class CustomUserResource(ModelResource):
    model = CustomUser


urlpatterns = patterns(
    '',
    url(r'^users/$',
        ListOrCreateModelView.as_view(resource=UserResource),
        name='users'),
    url(r'^users/(?P<id>[0-9]+)/$',
        InstanceModelView.as_view(resource=UserResource)),
    url(r'^customusers/$',
        ListOrCreateModelView.as_view(resource=CustomUserResource),
        name='customusers'),
    url(r'^customusers/(?P<id>[0-9]+)/$',
        InstanceModelView.as_view(resource=CustomUserResource)),
    url(r'^groups/$',
        ListOrCreateModelView.as_view(resource=GroupResource),
        name='groups'),
    url(r'^groups/(?P<id>[0-9]+)/$',
        InstanceModelView.as_view(resource=GroupResource)),
)


class ModelViewTests(TestModelsTestCase):
    """Test the model views djangorestframework provides"""
Пример #44
0
#from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, url
from djangorestframework.views import ListOrCreateModelView, InstanceModelView, ModelView, ListModelView
from contacts.resources import TestResource, AddressResource

from views import *
from django.conf import settings
import django.contrib.auth.views


urlpatterns = patterns('djangoextension.contacts.views',
    url(r'address/create/$', "root_view", name='root'),
    url(r'address/$', "list_view", name='list'),
    #url(r'address/query/(?P<query>[^/]+/$)', "query_view", name='query'),
    #url(r'address/.*$)', "query_view", name='query'),
    )

urlpatterns += patterns('',
    url(r'test/$', ListOrCreateModelView.as_view(resource=TestResource), name='test-root'),
    url(r'test/(?P<id>[^/]+)/$', InstanceModelView.as_view(resource=TestResource), name='test-post'),
    url(r'address/api/$', ListModelView.as_view(resource=AddressResource), name='address-root'),
    url(r'address/api/(?P<id>[^/]+)/$', InstanceModelView.as_view(resource=AddressResource), name='address-post'),

)

Пример #45
0
from django.conf.urls.defaults import patterns, url
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from modelresourceexample.resources import MyModelResource

urlpatterns = patterns(
    '',
    url(r'^$',
        ListOrCreateModelView.as_view(resource=MyModelResource),
        name='model-resource-root'),
    url(r'^(?P<pk>[0-9]+)/$',
        InstanceModelView.as_view(resource=MyModelResource)),
)