#12469: get_urls docs in ModelAdmin can be extended
------------------------------------+---------------------------------------
Reporter: benc | Owner: nobody
Status: new | Milestone:
Component: Documentation | Version: 1.1
Resolution: | Keywords: get_urls ModelAdmin
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by russellm):
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Old description:
> It might help to explain three things regarding custom views in
> ModelAdmin
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls
>
> 1. The path in the example r'^my_view/$' will be accessed at
> /admin/myapp/mymodel/my_view/
>
> 2. self.my_view in the example means that you probably want to define the
> view inside the MyModelAdmin Class so it has access to the ModelAdmin.
>
> 3. my_view will be called with the request and the ModelAdmin instance as
> arguments:
> def my_view(request, model_admin):
>
> A simple class with get_urls and a view will be best.
> Thanks
New description:
It might help to explain three things regarding custom views in ModelAdmin
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls
1. The path in the example r'!^my_view/$' will be accessed at
/admin/myapp/mymodel/my_view/
2. self.my_view in the example means that you probably want to define the
view inside the MyModelAdmin Class so it has access to the ModelAdmin.
3. my_view will be called with the request and the ModelAdmin instance as
arguments:
def my_view(request, model_admin):
A simple class with get_urls and a view will be best.
Thanks
--
Ticket URL: <http://code.djangoproject.com/ticket/12469#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en.