Hello,

I am programming (and learning django+python) a CMS. The core is working, now I am adding features and utils. One of them is a contact form. I have default functionality, but I want the user to overwrite default contact form in case he wants some fields added/removed or add some other things. I have made it an ugly way:

- minicms project is the CMS, usersproject is a project using minicms
- I have default ContactForm in minicms.plugins.contactform app
- I have user defined ContactForm which inherits from minicms.plugins.contactform.forms.ContactForm - I have custom template tag (in minicms.plugins.contactform.templatetags) which ask django.conf.settings where is user's custom form ( CONTACT_FORM = {'custom_form': 'usersproject.forms',} ), if it is defined, I import CONTACT_FORM['custom_form'].ContactForm instead of default minicms.plugins.contactform.forms.ContactForm
- displaying and processing of the form is now not important


This is not a very good way. Somewhere I have seen a technique, where parent object is "notified" or does know about objects which inherited from it. So I could inherit in userproject.forms.CustomContactForm from minicms.plugins.contactform.forms.ContactForm and in custom template tag import only minicms.plugins.contactform.forms.ContactForm (or some wrapper object) and it will be much cleaner. Can somebody point me to (or explain) this technique or show me some examples I can learn from? Or perhaps another approach to solve this problem.

Thanks,
Martin

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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