Re: Constraints on a one-to-many relationship and related problems

2012-01-03 Thread Andre Terra
First of all, welcome to Django! While many like to use the admin as a public facing CRUD app, that is not what it is designed for. In any case, writing your own forms is *a requirement* in pretty much every Django project, simply because no automatic form creation like the admin could possibly an

Re: Constraints on a one-to-many relationship and related problems

2011-12-29 Thread Bart Nagel
At 2011-12-28 06:59:31 -0800, Jay De Lanoy wrote: > I'd go for a separate table instead, with something like > > class BillingInfo(models.Model): > customer = models.OneToOneField(Customer) > billing_address = models.OneToOneField(Address) > > and then just have logic in the v

Re: Constraints on a one-to-many relationship and related problems

2011-12-29 Thread Bart Nagel
At 2011-12-28 06:21:38 -0800, Dan Gentry wrote: > Just looking at the models, I'd like to make a couple of suggestions. > > Instead of using a Foreign Key relationship in Customer to indicate > the billing address, I would include a flag called 'billing_address' > in the Address table that would

Re: Constraints on a one-to-many relationship and related problems

2011-12-28 Thread Jay De Lanoy
I'd go for a separate table instead, with something like class BillingInfo(models.Model): customer = models.OneToOneField(Customer) billing_address = models.OneToOneField(Address) and then just have logic in the views and templates to account for existence/nonexistence of a gi

Re: Constraints on a one-to-many relationship and related problems

2011-12-28 Thread Dan Gentry
Just looking at the models, I'd like to make a couple of suggestions. Instead of using a Foreign Key relationship in Customer to indicate the billing address, I would include a flag called 'billing_address' in the Address table that would be set to True for the customer selected address. An over

Constraints on a one-to-many relationship and related problems

2011-12-28 Thread Bart Nagel
I'm new to Django. I'm finding it very impressive so far but have hit a cluster of problems. I'm using the SVN version. Sorry for the length of this, I'm just trying to explain as fully as I can what I'm trying to do, what I have and what's going wrong. The relevant parts of my model, in the si