Deity
Deity

Reputation: 143

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.

Upvotes: 0

Views: 174

Answers (2)

Reto Aebersold
Reto Aebersold

Reputation: 16624

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'))

Upvotes: 0

manji
manji

Reputation: 47978

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.

Upvotes: 1

Related Questions