class ContactAdmin(Admin):

    form = EditContactForm


EditContactForm has a save method that is never called by the Admin

but its clean() function does get called

 60         def clean(self):
 61             import pdb; pdb.set_trace()

 my confusion is that due to the snakey admin code the form class is created
using a different name and is created in the scope of a different module.
 even though the class is explicitly specified in my Admin, that name is
replaced with     class_name = model.__name__ + 'Form'

 self.__class__
(Pdb) <class 'django.forms.models.ContactForm'>
self
(Pdb) <django.forms.models.ContactForm object at 0x23c16f0>
self.save
(Pdb) <bound method ContactForm.save of <django.forms.models.ContactForm
object at 0x23c16f0>>

dir(self)
(Pdb) ['Meta', '__class__', '__delattr__', '__dict__', '__doc__',
'__getattribute__', '__getitem__', '__hash__', '__init__', '__iter__',
'__metaclass__', '__module__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__str__', '__unicode__', '__weakref__',
'_changed_data', '_errors', '_get_changed_data', '_get_errors',
'_get_media', '_html_output', '_meta', 'add_initial_prefix', 'add_prefix',
'as_p', 'as_table', 'as_ul', 'auto_id', 'base_fields', 'changed_data',
'check_for_account', 'clean', 'clean_email', 'data', 'declared_fields',
'empty_permitted', 'error_class', 'errors', 'fields', 'files', 'full_clean',
'has_changed', 'initial', 'instance', 'is_bound', 'is_multipart',
'is_valid', 'label_suffix', 'media', 'non_field_errors', 'prefix', 'save',
'save_from_request', 'validate_unique', 'will_save']

I can see my clean_email method and other methods that I defined.  it
*is*my class, but its name and module have been changed which makes
debugging
quite difficult.

this leads me on a wild goose-chase trying to figure out why the wrong form
was instantiated.

is there any reason that normal classes aren't used ?  there doesn't seem to
be any use of passing in multiple bases

and I still don't know why save() isn't called by the admin

thankx for any insight

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to