django-simple-snippet / urls.py

"""

Snippet
-------

snippet is shown as a CRUD interface :

- create : '/new/'

- view detail : '/id'

- edit : '/id/edit/'

- delete : '/id/delete/'

Authors
-------
Authors are based on django.contrib.auth.models.User.

To create, and manage Users, you can use the django admin or the app of your choice

List of Users are displayed with : '/authors/'

and Snippet created by a user : '/authors/id'

Languages
---------

List of avalaible Language are : '/languages/'

Snippets for a particular Language are : '/language/id'

Tags
----

List of avalaible Tags are : '/tags/'

Snippets for a particular Tag are : '/tags/id'

"""
from django.conf.urls.defaults import patterns, include, url
from django.core.urlresolvers import reverse_lazy
from django.views.generic import CreateView,UpdateView,DeleteView, DetailView,\
      ListView
from models import Snippet, Language, Tag
from django.contrib.auth.models import User
from django.contrib.auth.views import login, logout
from feeds import LatestSnippetFeed

urlpatterns = patterns('',
    url(r'^$', ListView.as_view(model=Snippet), name="snippet_root"),
    url(r'^new/$', CreateView.as_view(model=Snippet), name="create_snippet"),
    url(r'^(?P<pk>\d+)/$',
        DetailView.as_view(model=Snippet),
        name="snippet_detail"),
    url(r'^(?P<pk>\d+)/edit/$', UpdateView.as_view(model=Snippet)),
    url(r'^(?P<pk>\d+)/delete/$',
        DeleteView.as_view(
            model=Snippet,
            success_url=reverse_lazy("snippet_root")
            )
        ),
#TODO add a paginated by on those views
    url(r'^authors/(?P<pk>\d+)/$',DetailView.as_view(model=User), name="author"),
    url(r'^authors/$',ListView.as_view(model=User),name="authors"),
    url(r'^languages/(?P<pk>\d+)/$',
        DetailView.as_view(model=Language),name="language"
        ),
    url(r'^languages/$',ListView.as_view(model=Language),
        name="languages"),
    url(r'^tags/(?P<pk>\d+)/$',DetailView.as_view(model=Tag), name="tag"),
    url(r'^tags/$',ListView.as_view(model=Tag), name="tags"),
    url(r'^feeds/snippet/$',LatestSnippetFeed())
    )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.