After a bunch of trial and error, basically, I've decided not to put the url
pattern in the ProvinceAdmin class. It is easier and makes more sense (to
me) to add the urls to myproject/urls.py and then create a file called
myproject/myapp/admin_views.py with the custom admin views. It's probably
Okay, I got it.
There was a typo in the hard-coded url pattern. The following actually does
not work:
** code **
(r'^/1/add_random_samurai/$', self.admin_site.admin_view(
self.add_random_samurai))
** /code **
But this does:
** code **
(r'^1/add_random_samurai/$',
Okay, I've got such a button and I have copied a template from admin to
serve as a stand-in for it. I have created functions under ProvinceAdmin (in
myapp\admin.py) that look like:
** code **
def ProvinceAdmin(admin.ModelAdmin):
# other stuff
def add_random_samurai(self, request):
On Feb 19, 2010, at 5:51 PM, Timothy Kinney wrote:
> So I have a nice little database now stocked with items and provinces.
> I now want to generate random samurai and populate the database with
> them. I can think of two ways to do this:
>
> 1) Through the admin interface. But how do I install
So I have a nice little database now stocked with items and provinces.
I now want to generate random samurai and populate the database with
them. I can think of two ways to do this:
1) Through the admin interface. But how do I install a button that
will add a random samurai? Adding samurai is a
5 matches
Mail list logo