layerindex-web/layerindex/urls.py
Paul Eggleton 26ab9dbb28 Add ability to add, edit and delete layer notes
This allows adding an important notice to a layer e.g. "this layer is
deprecated, please use layer xyz instead". Only one layer note can be
added through the interface although the data structures allow multiple,
so notes may be added programmatically without disturbing user-added
ones.

With this change we also add a get_absolute_url() function to the
LayerItem model and change the calls to reverse() for layers to use it.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-28 14:36:41 +00:00

59 lines
2.8 KiB
Python

# layerindex-web - URL definitions
#
# Copyright (C) 2013 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
from django.conf.urls.defaults import *
from django.views.generic import DetailView, ListView
from layerindex.models import LayerItem, Recipe
from layerindex.views import LayerListView, RecipeSearchView, MachineSearchView, PlainTextListView, LayerDetailView, edit_layer_view, edit_layernote_view, delete_layernote_view
urlpatterns = patterns('',
url(r'^$',
LayerListView.as_view(
template_name='layerindex/index.html'),
name='layer_list'),
url(r'^submit/$', edit_layer_view, {'template_name': 'layerindex/submitlayer.html'}, name="submit_layer"),
url(r'^edit/(?P<slug>[-\w]+)/$', edit_layer_view, {'template_name': 'layerindex/editlayer.html'}, name="edit_layer"),
url(r'^submit/thanks$', 'layerindex.views.submit_layer_thanks', name="submit_layer_thanks"),
url(r'^recipes/$',
RecipeSearchView.as_view(
template_name='layerindex/recipes.html'),
name='recipe_search'),
url(r'^machines/$',
MachineSearchView.as_view(
template_name='layerindex/machines.html'),
name='machine_search'),
url(r'^review/$',
ListView.as_view(
queryset=LayerItem.objects.order_by('name').filter(status__in='N'),
context_object_name='layer_list',
template_name='layerindex/index.html'),
name='layer_list_review'),
url(r'^layer/(?P<slug>[-\w]+)/$',
LayerDetailView.as_view(
template_name='layerindex/detail.html'),
name='layer_item'),
url(r'^layer/(?P<slug>[-\w]+)/addnote/$',
edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="add_layernote"),
url(r'^layer/(?P<slug>[-\w]+)/editnote/(?P<pk>[-\w]+)/$',
edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="edit_layernote"),
url(r'^layer/(?P<slug>[-\w]+)/deletenote/(?P<pk>[-\w]+)/$',
delete_layernote_view, {'template_name': 'layerindex/deleteconfirm.html'}, name="delete_layernote"),
url(r'^recipe/(?P<pk>[-\w]+)/$',
DetailView.as_view(
model=Recipe,
template_name='layerindex/recipedetail.html'),
name='recipe'),
url(r'^layer/(?P<name>[-\w]+)/publish/$', 'layerindex.views.publish', name="publish"),
url(r'^raw/recipes.txt$',
PlainTextListView.as_view(
queryset=Recipe.objects.order_by('pn', 'layer'),
context_object_name='recipe_list',
template_name='layerindex/rawrecipes.txt'),
name='recipe_list_raw'),
url(r'^about$', 'layerindex.views.about', name="about"),
url(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': 'layerindex/static/img/favicon.ico'}),
)