def fetch_urls(entry): entry.add_url_rule('/api/v1/entries/', view_func=EntryView.as_view('getallentries'), defaults={'entry_id': None}, methods=['GET',]) entry.add_url_rule('/api/v1/entries/<int:entry_id>/', view_func=EntryView.as_view('getoneentry'), methods=['GET',]) entry.add_url_rule('/api/v1/entries/',view_func=EntryView.as_view('postentry'), methods=['POST',]) entry.add_url_rule('/api/v1/entries/<int:event_id>/', view_func=EntryView.as_view('modifyanentry'), methods=['PUT',])
from django.conf.urls import * from views import EntryView from models import Entry from forms import EntryForm from views import post_entry list_dict = {'queryset': Entry.objects.filter(is_removed=False), 'paginate_by': 5, 'template_object_name': 'entry', 'extra_context': {'form': EntryForm(), }} last_page_dict = list_dict.copy() last_page_dict.update({'page': 'last'}) page_dict = list_dict.copy() page_dict.update({'allow_empty': False}) urlpatterns = patterns('', url(r'^$', EntryView.as_view(), last_page_dict, name='guestbook-page-last'), url(r'^page(?P<page>[0-9]+)/$', EntryView.as_view(), page_dict, name='guestbook-page'), url(r'^post/', post_entry, name='guestbook-post'), )
from models import Entry, Change, Relation, Alteration, Category from views import EntryList, EntryView, EntryCreate, EntryUpdate, EntryDelete,\ ChangeList, \ RelationCreate, RelationUpdate, \ CategoryCreate, CategoryUpdate, TagDetail urlpatterns = patterns('data.views', url(r'^$', 'index', name='data'), # Entries: ## Class-Views url(r'^entries/list/$', EntryList.as_view(paginate_by=10), name='list-entries'), url(r'^entry/table/$', EntryList.as_view(template_name='data/entry_table.html'), name='entry-table'), url(r'^entry/(?P<pk>\d+)', DetailView.as_view(model=Entry), name='detail-entry'), # User generic class-based view # template_name='entry_detail.html' # use defaults url(r'^entry/view/(?P<slug>.+)', EntryView.as_view(), name='view-entry'), url(r'^entry/create/$', EntryCreate.as_view(), name='create-entry'), url(r'^entry/update/(?P<pk>\d+)', login_required(EntryUpdate.as_view()), name='update-entry'), url(r'^entry/update/(?P<slug>.+)', login_required(EntryUpdate.as_view()), name='update-entry'), url(r'^entry/delete/(?P<pk>\d+)', login_required(EntryDelete.as_view()), name='delete-entry'), url(r'^entry/(?P<slug>.+)', EntryView.as_view(), name='detail-entry'), # Alternative detail entry accepting slug. url(r'^hierarchy/list/$', EntryList.as_view( context_object_name='entries', template_name='data/hierarchy.html'), name='list-hierarchy'), ## Function-Views: url(r'^entries/$', 'entries', name='entries'), url(r'^hierarchy/$', 'hierarchy', name='hierarchy'), url(r'^entry/(?P<slug>.+)', 'entry', name='data_entry'), # Classic view. url(r'^entry/add', 'add_entry', name='add_entry'),
) from feeds import EntryFeed, ChangeFeed, RelationFeed, AlterationFeed, CategoryFeed urlpatterns = patterns( "data.views", url(r"^$", "index", name="data"), # Entries: ## Class-Views url(r"^entries/list/$", EntryList.as_view(paginate_by=20), name="list-entries"), url(r"^entry/table/$", Entries.as_view(template_name="data/entry_table.html"), name="entry-table"), # url(r'^entry/table/$', EntryList.as_view(template_name='data/entry_table.html'), name='entry-table'), url( r"^entry/(?P<pk>\d+)", DetailView.as_view(model=Entry), name="detail-entry" ), # User generic class-based view # template_name='entry_detail.html' # use defaults url(r"^entry/view/(?P<slug>.+)", EntryView.as_view(), name="view-entry"), url(r"^entry/create/$", EntryCreate.as_view(), name="create-entry"), url(r"^entry/generate/(?P<title>.+)", Generate.as_view(), name="generate-entry"), url(r"^entry/update/(?P<pk>\d+)", login_required(EntryUpdate.as_view()), name="update-entry"), url(r"^entry/update/(?P<slug>.+)", login_required(EntryUpdate.as_view()), name="update-entry"), url(r"^entry/delete/(?P<pk>\d+)", login_required(EntryDelete.as_view()), name="delete-entry"), url(r"^entry/feed/$", EntryFeed(), name="data-entry-feed"), url(r"^entry/(?P<slug>.+)", EntryView.as_view(), name="detail-entry"), # Alternative detail entry accepting slug. url(r"^hierarchy/list/$", HierarchyList.as_view(), name="list-hierarchy"), ## Function-Views: url(r"^entries/$", "entries", name="entries"), url(r"^hierarchy/$", "hierarchy", name="hierarchy"), url(r"^entry/(?P<slug>.+)", "entry", name="data_entry"), # Classic view. url(r"^entry/add", "add_entry", name="add_entry"), url(r"^entry/edit", "edit_entry", name="edit_view"), url(r"^entry/remove", "remove_entry", name="remove_entry"),
from django.conf.urls import patterns from views import EntryView, PostDetailView, NewPostView urlpatterns = patterns('', (r'^index/$', EntryView.as_view()), (r'^(?P<pk>\d+)', PostDetailView.as_view()), (r'^new_post/$', NewPostView.as_view()), )
# Entries: ## Class-Views url(r'^entries/list/$', EntryList.as_view(paginate_by=10), name='list-entries'), url(r'^entry/table/$', Entries.as_view(template_name='data/entry_table.html'), name='entry-table'), #url(r'^entry/table/$', EntryList.as_view(template_name='data/entry_table.html'), name='entry-table'), url( r'^entry/(?P<pk>\d+)$', DetailView.as_view(model=Entry), name='detail-entry' ), # User generic class-based view # template_name='entry_detail.html' # use defaults url(r'^entry/view/(?P<slug>.+)', EntryView.as_view(), name='view-entry'), url(r'^entry/create/$', EntryCreate.as_view(), name='create-entry'), url(r'^entry/generate/(?P<title>.+)', login_required(Generate.as_view()), name='generate-entry'), url(r'^entry/update/(?P<pk>\d+)', login_required(EntryUpdate.as_view()), name='update-entry'), url(r'^entry/update/(?P<slug>.+)', login_required(EntryUpdate.as_view()), name='update-entry'), url(r'^entry/delete/(?P<pk>\d+)', login_required(EntryDelete.as_view()), name='delete-entry'), url(r'^entry/feed/$', EntryFeed(), name='data-entry-feed'), url(r'^entry/(?P<slug>.+)', EntryView.as_view(),