From your code, it seems like you're trying to add intermediate action views to your ModelAdmin class.
This is achieved by putting the function name in the actions attribute. If you just add a custom action, there is no need to add a custom URL. Your example can be changed as follows:
class JobTitleAdmin(admin.ModelAdmin): inlines = [OccupationTagInline, ] model = JobTitle search_fields = ['title',] list_filter = ['status',] actions =['add_to_job_category', 'move_to_job_category' ] def add_to_job_category(self, request, queryset): return render_to_response( 'admin/job_title/select_job_category.html', { 'action': 'add', 'featured_occupations': Occupation.objects.filter(featured=True), 'title_ids': array(request.GET['foo'])
The ModelAdmin class will know how to call your custom function and add an action to the expansion of the action. The intermediate view of the add_to_job_category response add_to_job_category to know how to receive data from the action in order to determine which items have been selected.
If you really want to add a custom URL, your get_urls() function will prove to be correct. Note that the URLs returned by get_urls refer to admin/<app>/<model> .
If your application was named myapp and your JobTitle model, then the URL of your add_to_job_category will look like this:
http://some.site/admin/myapp/jobtitle/add_to_job_category/
source share