django-dburlresolvers 0.1.0 Beta 2

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

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!

What's new in django-dburlresolvers 0.1.0 Beta:

  • Fixed a model form error when used outside admin.
Read full changelog
send us
an update
LICENSE TYPE:
LGPL (GNU Lesser General Public License) 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Manuel Saelices
HOMEPAGE:
pypi.python.org
CATEGORY:
ROOT \ Internet \ HTTP (WWW)
django-dburlresolvers is an URL resolver which stores 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.

Last updated on March 11th, 2011

requirements

#URL resolver #URL patterns #Django #URL #resolver #patterns

Add your review!

SUBMIT