Reputation: 5863
In my admin.py I have done..
class MediaManagerAdmin(admin.ModelAdmin):
def get_urls(self):
urls = super(MediaManagerAdmin, self).get_urls()
print "some"
my_urls = [
url(r'^mediacontrol/',self.my_view),
]
return my_urls + urls
print "helloww"
def my_view(self,request):
return render_to_response("anything.html")
admin.site.register(MediaManager, MediaManagerAdmin)
Here what I want is in admin when I click the MediaManager table it should redirect to my custom url url(r'^mediacontrol/',self.my_view),
with my custom view and template.
But its not redirecting to this url. It is redirecting to the usual admin url. Nothing is changing same like regular admin.
How can I redirect a table to my custom view and template in admin.
Need help
Upvotes: 1
Views: 776
Reputation: 45575
Set the regex for your view to the empty string:
my_urls = [
url(r'^$', self.my_view),
]
Upvotes: 2