On 1/20/07, Honza Král <[EMAIL PROTECTED]> wrote:
> why not create a function to do that for you..
> urls.py is after all a python module, so you could just introduce a function
>
> urlpatterns = admin_urls_for_model(
> MyModel,
> field_list=[ 'field' ],
> exclude_actions=[ admin.EDIT ],
> perms_required={
> admin.EDIT : 'can_change_MyModel',
> admin.LIST : 'something_else'
> }
> )
I must not have explained this correctly. In the newforms-admin
branch, all of those options are specified in a class, ModelAdmin. The
goal here is to figure out how those classes interact with the
URLconf. There's no need to pass dictionaries around -- all of that
configuration is in the class.
Something like this is what I had in mind:
"""
from myapp.models import PollAdmin, ChoiceAdmin
urlpatterns = patterns('',
(r'^admin/', include('django.contrib.admin.urls'), {'models':
(PollAdmin, ChoiceAdmin)})
)
"""
The problem here is that each time you add an admin interface to a
model, you have to remember to add it to your URLconf. Maybe there can
be a helper function that looks for all Admin classes, as long as you
save them in a file called admin.py within the app, but that's kind of
magic.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---