# models.py
# - - - - - - - - 
from django.conf.urls.defaults import patterns, url

class Accessor(object):
    @classmethod
    def get_url_patterns(cls):
        model = cls._meta.object_name.lower()
        acc = []
        if 'get' in cls.access:
            acc.append((r'^%s/(?P<id>\d+)/get/$' %model, '%s_get' % model))
            acc.append((r'^%s/page/(?P<page>\d+)/get/$' % model, '%s_page_get' % model))
        if 'new' in cls.access:
            acc.append((r'^%s/new/post/$' % model, '%s_new_post' % model))
            acc.append((r'^%s/new/get/$' % model, '%s_new_get' % model))
        return [url(*p) for p in acc]

    @classmethod
    def get_default_page(cls):
        app = cls._meta.app_label.lower()
        model = cls._meta.object_name.lower()
        return '/%s/%s/page/1/get/' %(app, model)

class Private(Accessor):
    access = ()

class All(Accessor):
    access = ('get', 'new')

class ReadOnly(Accessor):
    access = ('get',)

class Admin(Accessor):
    access = All.access + ('admin',)

# - - - - - - - - 
utils.py
# - - - - - - - - 
from django.contrib.contenttypes.models import ContentType
from django.conf.urls.defaults import patterns


def get_model_paths(app_label):
    urls = []
    for content in ContentType.objects.filter(app_label=app_label):
        model = models.get_model(app_label=content.app_label, model_name=content.model)
        if hasattr(model, 'get_url_patterns'):
            urls.extend(model.get_url_patterns())
    return patterns('myapp.Main.views', *urls)