Ejemplo n.º 1
0
                 '/<int:item_id>',
                 view_func=ItemView.as_view('item_view'))
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/json',
                 view_func=ItemView.as_view('item_json'))
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/xml',
                 view_func=ItemView.as_view('item_xml'))
# /category/item_id/delete
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/delete',
                 view_func=ItemDeleteView.as_view('itemdelete_view'))
# /category/item_id/update
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/update',
                 view_func=ItemUpdateView.as_view('itemupdate_view'))
app.add_url_rule("/me", view_func=MyAccountView.as_view('myaccount_view'))
app.add_url_rule("/items/add", view_func=ItemAddView.as_view('additem_view'))

app.add_url_rule("/user/<int:uid>", view_func=UserView.as_view('user_view'))

# /img/image.jpg - serves images from the db
app.add_url_rule("/img/<pid>",
                 view_func=ShowPictureView.as_view('showpicture_view'))

# delete current user - deletes their items as well
app.add_url_rule("/delete", view_func=DelUser.as_view('deleteuser_view'))
app.add_url_rule("/login", view_func=LoginView.as_view('login_view'))
app.add_url_rule("/logout", view_func=LogoutView.as_view('logout_view'))

app.add_url_rule("/disconnect",
Ejemplo n.º 2
0
                   ItemCreateView,
                   ItemRetrieveView,
                   ItemUpdateView,
                   ItemDeleteView)

urlpatterns = [
    url(r'^$',
        SearchView.as_view(),
        name='search'),

    url(r'^item/suggestions/$',
        SuggestionsView.as_view(),
        name='suggestions'),

    url(r'^item/create/$',
        ItemCreateView.as_view(),
        name='item-create'),

    url(r'^item/(?P<pk>\d+)/$',
        ItemRetrieveView.as_view(),
        name='item-retrieve'),

    url(r'^item/update/(?P<pk>\d+)/$',
        ItemUpdateView.as_view(),
        name='item-update'),

    url(r'^item/delete/(?P<pk>\d+)/$',
        ItemDeleteView.as_view(),
        name='item-delete')
]
    '/<regex("{}"):category>/xml'.format(
        utils.get_cat_regex()),
    view_func=CategoryView.as_view('category_xml'))
# /category/item_id
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>', view_func=ItemView.as_view('item_view'))
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/json', view_func=ItemView.as_view('item_json'))
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/xml', view_func=ItemView.as_view('item_xml'))
# /category/item_id/delete
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/delete', view_func=ItemDeleteView.as_view('itemdelete_view'))
# /category/item_id/update
app.add_url_rule('/<regex("{}"):category>'.format(utils.get_cat_regex()) +
                 '/<int:item_id>/update', view_func=ItemUpdateView.as_view('itemupdate_view'))
app.add_url_rule("/me", view_func=MyAccountView.as_view('myaccount_view'))
app.add_url_rule("/items/add", view_func=ItemAddView.as_view('additem_view'))

app.add_url_rule("/user/<int:uid>", view_func=UserView.as_view('user_view'))

# /img/image.jpg - serves images from the db
app.add_url_rule(
    "/img/<pid>",
    view_func=ShowPictureView.as_view('showpicture_view'))

# delete current user - deletes their items as well
app.add_url_rule("/delete", view_func=DelUser.as_view('deleteuser_view'))
app.add_url_rule("/login", view_func=LoginView.as_view('login_view'))
app.add_url_rule("/logout", view_func=LogoutView.as_view('logout_view'))