Re: Noob: form class location

2008-08-24 Thread Gerard Petersen
True, but it took me some figuring out and there's still some 'spaghetti'. The import of models was needed on more then one place (next to views.py) because of the meta class. myforms.py: from models import * class CustomerForm(ModelForm): class Meta: model = Customer Regards, G

Re: Noob: form class location

2008-08-24 Thread phillc
if im moving my form related logic to another file, i wouldnt really need to import forms else where? ;) On Aug 23, 9:10 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Sat, Aug 23, 2008 at 8:59 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: > > > Hi, > > > In Django there are no 'standar

Re: Noob: form class location

2008-08-24 Thread Gerard Petersen
Julien, It's working. It took some shuffling of import statements because I subclass ModelForm in there for use with form.as_table Anyway, thanx again! Regards, Gerard. Julien Phalip wrote: > The import is likely to be in your view: > > # views.py > from forms import MyForm > > myview(requ

Re: Noob: form class location

2008-08-23 Thread Julien Phalip
The import is likely to be in your view: # views.py from forms import MyForm myview(request): if request.method == 'POST': form = MyForm(request.POST) ... That's assuming that views.py and forms.py are at the same level. Cheers, Julien On Aug 23, 11:25 pm, Gerard Petersen <[E

Re: Noob: form class location

2008-08-23 Thread Gerard Petersen
Julien/Russell, Thanx for the info. Working around the name class would simply be resolved by a 'myforms.py' (or something). One thing is still missing in my brain though. If I put it in a myforms.py. How does Django (or my code if you will) knows where to find this class. There should be an i

Re: Noob: form class location

2008-08-23 Thread Russell Keith-Magee
On Sat, Aug 23, 2008 at 8:59 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: > > Hi, > > In Django there are no 'standard' as such. You'd talk more about > 'conventions'. > One common way is to put all your forms in forms.py. But that's just > for cleanliness. While this is a common convention, I wo

Re: Noob: form class location

2008-08-23 Thread Julien Phalip
Hi, In Django there are no 'standard' as such. You'd talk more about 'conventions'. One common way is to put all your forms in forms.py. But that's just for cleanliness. Python lets you create whatever architecture you like for your apps. So, basically, do whatever you feel most comfortable with