Re: adding fields into another apps forms (in plugin style)

2012-06-30 Thread spu
I think he wants to load the plugins in a dynamic way. If you look how the 
admin package of django works you will have the answer:

The class AdminSite has a method register, which adds a model, on which the 
site builds itself. So each plugin can register its own admin stuff in a 
admin module. 

Your task is to write your own class that registers plugins and to make a 
global instance of it.

Am Mittwoch, 19. Januar 2011 15:38:07 UTC+1 schrieb Shawn Milochik:
>
> You can just subclass the form or modelform.
>
> Shawn
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/tkvtGsvvXm8J.
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.



Re: adding fields into another apps forms (in plugin style)

2011-01-19 Thread Shawn Milochik

You can just subclass the form or modelform.

Shawn

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



Re: adding fields into another apps forms (in plugin style)

2011-01-19 Thread Marc Aymerich
On Wed, Jan 19, 2011 at 3:00 AM, Michael Buckley  wrote:
> I have been looking at the docs, but so far I can't find anything to help.
> I am looking to set up some kind of plugin system, so for example I set up
> my base user registration form, then I might have another app that when
> added to INSTALLED_APPS automatically adds fields into that form.
>
> Been looking in django for a way of easily injecting those extra fields into
> the form, but I can't find anything.  Is there?  Or do I need to write my
> own system?

I've never tried this with forms but I think that if you import the
form that you want to modify and then add then new fields, it should
work.

from my_base_app.forms import BaseForm
BaseForm.plugin_field1 = forms.blablabla
BaseForm.plugin_field2 = forms.blablabla


-- 
Marc

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



adding fields into another apps forms (in plugin style)

2011-01-18 Thread Michael Buckley
I have been looking at the docs, but so far I can't find anything to help.  
I am looking to set up some kind of plugin system, so for example I set up 
my base user registration form, then I might have another app that when 
added to INSTALLED_APPS automatically adds fields into that form.

Been looking in django for a way of easily injecting those extra fields into 
the form, but I can't find anything.  Is there?  Or do I need to write my 
own system?

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