Skip to main content

Django-based URL resolving mechanism, which store the URL patterns in database

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')),
        )

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-dburlresolvers-0.1.0-beta.tar.gz (10.9 kB view details)

Uploaded Source

File details

Details for the file django-dburlresolvers-0.1.0-beta.tar.gz.

File metadata

File hashes

Hashes for django-dburlresolvers-0.1.0-beta.tar.gz
Algorithm Hash digest
SHA256 767c082571518a40441684300fe9087c54e17325e0b4252cc90189ad6c2e9d57
MD5 8b93527f3ce98f1d1cdfbe14cafd7677
BLAKE2b-256 ce7a5cabd18fc6d8ffe6696d5a08e0a9d1f095d259b6b62e366b8569f0b44b7c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page