开发者

Resolving an "Admin" object in admin.py

So, I'm following the example on django-ajax-selects:

http://code.google.com/p/django-ajax-selects/

and I have gotten up to the part where we are create the following class in admin.py:

class ContactMailingAdmin(Admin):
    form = make_ajax_form(ContactMailing,dict(author='contact',contacts='contact'))

The problem is that the "Admin" in the parameter list is unable to be resolved and I was wondering if anyone knows what to import to get that to resolve or if it's OK to replace it with admin.ModelAdmin. Basically, how would I go about getting the example listed on the site (linked above) to work. I've tried looking in "django.contrib.auth.admin" and "django.contrib.auth.models" but can't seem to find anything useful.

Thanks in advance for any pointers and help.

I'm relatively new to Django so if I've left out any information or if you need any sort of clarification, please do let me know and开发者_运维问答 I'll be happy to provide it.


There is no Admin class in django-select and I see in their admin.py that they are using django.contrib.auth.admin.ModelAdmin

--> it's a typo and you can use django.contrib.auth.admin.ModelAdmin.


First have a look at ModelAdmin objects. Try to do this:

from django.contrib import admin

class ContactMailingAdmin(admin.ModelAdmin):
    form = make_ajax_form(ContactMailing,dict(author='contact',contacts='contact'))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜