On Mar 4, 9:11 pm, Brian Neal <bgn...@gmail.com> wrote: > I'd like to make my own custom view. In the past I did this by > following the django book and added a URL to my main urlpatterns above > the '^admin/(.*)' pattern. But I noticed a new get_urls function on > the ModelAdmin class in the docs. I'm on trunk, and just did an svn > update to 9975 to try this out. > > The docs for get_urls show the view being registered as self.view. Is > that possible to register a class method as a view? > > Anyway, just to try things out, I created a view function right in my > admin.py file, and my admin.py file looks like this: > > http://dpaste.com/6643/ > > I'm kind of guessing here about the URL I need to visit to trigger > this new view. My model lives at admin/gcalendar/event, so I'm > guessing I need to visit admin/gcalendar/event/my_view. When I do > that, I get this error: > > ValueError at /admin/gcalendar/event/my_view/ > > invalid literal for int() with base 10: 'my_view' > > With this traceback: http://dpaste.com/6649/ > > For reference, here is my models.py: http://dpaste.com/6650/ > > Thanks!
I put an assert in my get_urls() function and it was not getting hit. I made sure that my Django contrib/admin/options.py file does indeed have the get_urls() function. I deleted all the *.pyc files under site-packages/django and redid the 'sudo python setup.py install' step. Still no go. I think it is just trying the last default pattern in the base ModelAdmin get_urls() and choking on that. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---