This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A URL resolver which store the URL patterns in database, which means a webmaster can define some URLs.

Installing

Install package from pypi:

$ easy_install django-dburlresolvers

Put dbresolver into your installed applications:

INSTALLED_APPS = (
    ...
    'dbresolver',
)

Change the project urls.py file like this:

from dbresolver import get_dbresolver_patterns

urlpatterns = patterns('',
    ... # your URLs
)

urlpatterns += get_dbresolver_patterns()

Usage

Register some views of your project to get available in dbresolver. You may register it manually or automatically (by autodiscovering):

  • Manually: Using the dbresolver API directly:

    >>> from dbresolver import register_view
    >>> from fooapp.views import foo_listing
    >>> register_view(foo_listing, 'Foo listing')
    
  • Automatically: Put this code in your project (we recommended in the project urls.py):

    from dbresolver import autodiscover_views
    autodiscover_views()
    

    You need to define an especial views_to_register method, like ilustrate this example:

    def foo_listing(request):
        foo_list = FooModel.objects.all()
        return render_to_response('fooapp/foo_listing.html',
                                {'foo_list': foo_list},
                                 context_instance=RequestContext(request))
    
    def views_to_register():
        """ returns views to be registered with dbresolver """
        return (
            (foo_listing, _('Foo listing')),
        )
    

Also you can register generic views with parameters. For example, imagine you have a view like this:

def render_template(request, template_name=None):
    try:
        return direct_to_template(request, template=template_name)
    except TemplateDoesNotExist:
        raise Http404()

You may register the view with a parameter which be defined for admin user:

>>> from configfield import params
>>> register_view(render_template, 'Generic view to render a template',
                  params=(
                      params.Template(
                          name='template_name',
                          label='Template to be rendered',
                      ),
                  ))

If you want autoregistering of that view, the code was like this:

def views_to_register():
    return (
        {'view': render_template,
         'label': 'Generic view to render a template',
         'params': (
             params.Template(name='template_name', label='Template to be rendered'),
        )},

Now you only have to enter on admin site to create URL patterns attached to views. You can use both Django default regular expressions and simpler surlex expressions.

0.1.0-beta

Fixed a model form error when used outside admin.

0.1.0-alpha

Initial version

Release History

Release History

0.1.0-beta2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0-beta

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-dburlresolvers-0.1.0-beta2.tar.gz (11.7 kB) Copy SHA256 Checksum SHA256 Source Mar 9, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting