Re: Django Model inheritance and foreignkeys

2009-11-01 Thread Andew Gee
That works great...thanks bruno desthuilliers wrote: > On 29 oct, 23:49, Andew Gee wrote: > > Hi, > > > > I have the following models > > > >     class Person(models.Model): > >       name = models.CharField(max_length=100) > > > >     clas

Django Model inheritance and foreignkeys

2009-10-29 Thread Andew Gee
Hi, I have the following models class Person(models.Model): name = models.CharField(max_length=100) class Employee(Person): job = model.Charfield(max_length=200) class PhoneNumber(models.Model): person = models.ForeignKey(Person) How do I access the PhoneNumbers

Re: Passing Parameter to form in inlineformset_factory

2009-10-25 Thread Andew Gee
Thanks for the help. I did find this as a solution ad it seems to work Formset = inlineformset_factory(ModelA, ModelB form=MyForm) Formset.form = staticmethod(curry(MyForm, reaOnly=readOnlyvalue)) myFormset = Formset(request.Files, instance=modelAInst) Regards Andrew Andew Gee wrote: >

Passing Parameter to form in inlineformset_factory

2009-10-22 Thread Andew Gee
Hi, I have the following Form defined class MyForm(ModelForm) def __init__(self, readOnly=False, *args, **kwargs): if readOnly: Do stuff to make the inputs readonly MyForm works perfectly when I instantiate it in the view as a form form = MyForm(readOnly=True, instance=ModelA

Re: Dynamically add a line to an inlineformset

2009-08-22 Thread Andew Gee
Well...I don't know what happened but I have put my loop back in and now it works. I cannot get the problem to reproduce. I must have had something out of place but I don't know what, but it works now which is what I need. So again thanks for your help. Andrew On Aug 22, 7:27 pm,

Re: Dynamically add a line to an inlineformset

2009-08-22 Thread Andew Gee
over the fields to see why it was being overwritten. Thanks very much for your help. Andrew On Aug 22, 5:13 pm, Matthias Kestenholz wrote: > On Sat, Aug 22, 2009 at 7:53 AM, Andew Gee wrote: > > > Thank you for your help. > > > I have managed to get the inlineforms to reproduc

Re: Dynamically add a line to an inlineformset

2009-08-21 Thread Andew Gee
being passed back by the request. Is this something that someone has seen before? Andrew On Aug 21, 12:07 am, Noah wrote: > http://www.djangosnippets.org/snippets/1389/ > > On Aug 20, 1:09 am, Matthias Kestenholz > > wrote: > > On Thu, Aug 20, 2009 at 7:27 AM, Andew Gee wrote

Dynamically add a line to an inlineformset

2009-08-19 Thread Andew Gee
Does anyone know how to add a new line to anlineformset dynamically? I have a page that contains an inlineformset and I need to be able to click a button and add a new line which will then be saved when the form is submitted, is that possible? Thanks Andrew --~--~-~--~~~--

How to use inlineformset with a manytomany relationship

2009-08-18 Thread Andew Gee
Hi, Is there a way to create an inlineformset for two models with manytomany relationship. I have created: class Person(models.Model): name = models.CharField phone= models.ManyToMany(Phone) class Phone(models.Model): PHONE_CHOICES(('H','Home'),('W",'Work'),('M','Mobile'))

Re: Formwizard and subforms

2009-08-17 Thread Andew Gee
That's a given. But thanks for your input, very helpful! On Aug 18, 6:53 am, Wayne Koorts wrote: > > Nobody can help me with this? > > If somebody: > > a) Has the answer and, > b) Has the time and, > c) The inclination to provide the answer, then they will do so. --~--~-~--~~

Re: Formwizard and subforms

2009-08-17 Thread Andew Gee
Nobody can help me with this? On Aug 15, 10:14 am, Gee wrote: > Hi, > > I am trying to build aformwizardthat includes a manytomany > relationship on one of the steps and I am stuck on to implement the > manytomany. The models are, (only for step in question) > > class Person(models.Model): >