Beispiel #1
0

# VIEWS
urlpatterns = patterns(
    'plugins.views',

    url(r'^edit/(?P<plugin_id>\d+)/$',
        PluginEditView.as_view(),
        name="plugin_edit"),

    url(r'^submit/$',
        plugin_submit,
        name="plugin_submit"),

    url(r'^(?P<plugin_id>\d+)/$',
        PluginDetailView.as_view(),
        name="plugin_detail"),

    url(r'^$',
        PluginListView.as_view(),
        name="plugin_list"),
)

# API
urlpatterns += patterns(
    'plugins.api',

    # URLs for existing/old versions
    url(r'^official/$',
        get_plugins_dict,
        {'query': 'official'}),
Beispiel #2
0
    url(r'^(?P<package_name>[A-Za-z][A-Za-z0-9-_]+)/version/(?P<version>[^\/]+)/update/$', 'version_update', {}, name='version_update'),
    url(r'^(?P<package_name>[A-Za-z][A-Za-z0-9-_]+)/version/(?P<version>[^\/]+)/download/$', 'version_download', {}, name='version_download'),
    url(r'^(?P<package_name>[A-Za-z][A-Za-z0-9-_]+)/version/(?P<version>[^\/]+)/approve/$', 'version_approve', {}, name='version_approve'),
    url(r'^(?P<package_name>[A-Za-z][A-Za-z0-9-_]+)/version/(?P<version>[^\/]+)/unapprove/$', 'version_unapprove', {}, name='version_unapprove'),
)

# RPC
urlpatterns += patterns('',
    # rpc4django will need to be in your Python path
    (r'^RPC2/$', 'rpc4django.views.serve_rpc_request'),
)


# plugin rating
from djangoratings.views import AddRatingFromModel

urlpatterns += patterns('',
    url(r'rate/(?P<object_id>\d+)/(?P<score>\d+)/', AddRatingFromModel(), {
        'app_label': 'plugins',
        'model': 'plugin',
        'field_name': 'rating',
    }, name='plugin_rate'),
)


# Plugin detail (keep last)
urlpatterns += patterns('plugins.views',
    url(r'^(?P<package_name>[A-Za-z][A-Za-z0-9-_]+)/$', PluginDetailView.as_view(slug_url_kwarg='package_name', slug_field='package_name'), name='plugin_detail'),
)