當前位置: 首頁>>代碼示例>>Python>>正文


Python views.InstanceModelView類代碼示例

本文整理匯總了Python中djangorestframework.views.InstanceModelView的典型用法代碼示例。如果您正苦於以下問題:Python InstanceModelView類的具體用法?Python InstanceModelView怎麽用?Python InstanceModelView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了InstanceModelView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_narcissus_urls

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
開發者ID:biggers,項目名稱:django-narcissus,代碼行數:23,代碼來源:urls.py

示例2: patterns

#-*- 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)),
)
開發者ID:KristianOellegaard,項目名稱:dploi-server,代碼行數:9,代碼來源:api_urls.py

示例3: BackupTaskResource

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)),
)
開發者ID:AgarFu,項目名稱:arritranco,代碼行數:30,代碼來源:urls.py

示例4: patterns

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'),
)
開發者ID:vsirisanthana,項目名稱:adios-agile,代碼行數:8,代碼來源:urls.py

示例5: patterns

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)),
)
開發者ID:vitormazzi,項目名稱:django-rest-framework,代碼行數:16,代碼來源:urls.py

示例6: patterns

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)),
)
開發者ID:Audish,項目名稱:django-rest-framework,代碼行數:8,代碼來源:urls.py

示例7: patterns

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'),
開發者ID:Sagelt,項目名稱:DjangoFlock,代碼行數:31,代碼來源:urls.py

示例8: patterns

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'),
)
開發者ID:Luka1002,項目名稱:we,代碼行數:12,代碼來源:urls.py

示例9: patterns

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,})
)
開發者ID:scudc,項目名稱:ProgressManager,代碼行數:23,代碼來源:urls.py

示例10: UserProfileResource

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)),
)
開發者ID:tukeq,項目名稱:cantin,代碼行數:17,代碼來源:accounts.py

示例11: patterns

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)),
)
開發者ID:mebusw,項目名稱:lotr-django-rest,代碼行數:20,代碼來源:urls.py

示例12: patterns

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'),
)
開發者ID:lincolndbryant,項目名稱:brunch-django-examples,代碼行數:13,代碼來源:urls.py

示例13: patterns

# 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)),
)
開發者ID:lloydchang,項目名稱:TrustScore,代碼行數:12,代碼來源:urls.py

示例14: patterns

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)),
)
開發者ID:nickpack,項目名稱:WIC-Site,代碼行數:29,代碼來源:urls.py

示例15: patterns

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)),
)
開發者ID:4nkh,項目名稱:django-unchained,代碼行數:20,代碼來源:urls.py


注:本文中的djangorestframework.views.InstanceModelView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。