Re: WANTED: Demonstration of good FK & M2M form creation
You could do this pretty easily using your own forms ( not NewForms and not Add/Change Manipulators ) along with the Django DB objects. It's pretty easy to do a CustomChangeManipulator with fields from two tables if it's just a one to one relationship, but for M2M, I usually either roll my own or I display a list of the rentals with an 'edit' link next to each item in the list. On May 20, 2:19 pm, David Priest <[EMAIL PROTECTED]> wrote: > I believe I have performed exhaustive research on the challenge of > creating forms that incorporate fields from multiple tables. I have > not found *any* comprehensive, best-practices examples of this problem. > > It really quite surprises me, as any web application of even moderate > complexity requires multiple tables. > > Anyway, I think everyone (and especially all us n00bs) would *really* > appreciate a good bit of demonstration code for the following sort of > scenario: > > class Customer(models.Model): > name = models.CharField() > phone = models.PhoneNumber() > > class Rentals(models.Model): > title = models.CharField() > serial = models.Integer() > rented_to = models.ForeignKey(Customer) > rental_due = models.DateField() > > The Form should display the customer's name, phone number, and the > movies the customer has rented, but *not* the date they're due > ('cause I'd like this problem to represent real-world problems, where > one doesn't necessarily display all the fields for editing). > > I've been battling at this for days, reading a lot of newsposts and > websites, and I've come up with bupkiss. It is extraordinarily > frustrating. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: WANTED: Demonstration of good FK & M2M form creation
On Tue, 2007-05-22 at 17:23 -0700, David Priest wrote: > On 07-May-21, at 5:56 PM, Malcolm Tredinnick wrote: > > It sounds like you want the django.newforms.formsets capability that > > isn't on trunk yet. > > > > > A little more patience will be required. > > Is this patience measured in days and short weeks, or in long weeks > turning to months? I need to decide whether I do it all by hand > right-this-moment, or delay until I can use the new newforms > capabilities... I have no real idea, although I'd lean towards the shorter periods. The real answer is that there's no real promise we can make here. We're all volunteers and most of us have lives of some extent or another. If you really wanted to do something now, grab formsets.py from the newforms-admin branch and start playing with (and extending, if necessary) that. Then when it is merged into trunk, you'll already have a start, even if you have to customise your code. Regards, Malcolm --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: WANTED: Demonstration of good FK & M2M form creation
On 07-May-21, at 5:56 PM, Malcolm Tredinnick wrote: > It sounds like you want the django.newforms.formsets capability that > isn't on trunk yet. > > A little more patience will be required. Is this patience measured in days and short weeks, or in long weeks turning to months? I need to decide whether I do it all by hand right-this-moment, or delay until I can use the new newforms capabilities... I'm loving where Django is heading. :-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: WANTED: Demonstration of good FK & M2M form creation
Next time I'll RTFT (read the fliping thread) correctly :-P Thanks Malcolm. J On May 21, 6:30 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-05-21 at 18:25 -0700, John M wrote: > > So Malcolm, does that mean its in the devl version we could see? > > > J > > > On May 21, 5:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> > > wrote: > [] > > > It sounds like you want the django.newforms.formsets capability that > > > isn't on trunk yet. There is an initial implementation in the > > > newforms-admin branch > > ^^ > > Was this too subtle? :-) > > It really is in the newforms-admin branch. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: WANTED: Demonstration of good FK & M2M form creation
On Mon, 2007-05-21 at 18:25 -0700, John M wrote: > So Malcolm, does that mean its in the devl version we could see? > > J > > On May 21, 5:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: [] > > It sounds like you want the django.newforms.formsets capability that > > isn't on trunk yet. There is an initial implementation in the > > newforms-admin branch ^^ Was this too subtle? :-) It really is in the newforms-admin branch. Regards, Malcolm --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: WANTED: Demonstration of good FK & M2M form creation
So Malcolm, does that mean its in the devl version we could see? J On May 21, 5:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-05-20 at 11:19 -0700, David Priest wrote: > > I believe I have performed exhaustive research on the challenge of > > creating forms that incorporate fields from multiple tables. I have > > not found *any* comprehensive, best-practices examples of this problem. > > > It really quite surprises me, as any web application of even moderate > > complexity requires multiple tables. > > > Anyway, I think everyone (and especially all us n00bs) would *really* > > appreciate a good bit of demonstration code for the following sort of > > scenario: > > > class Customer(models.Model): > >name = models.CharField() > >phone = models.PhoneNumber() > > > class Rentals(models.Model): > >title = models.CharField() > >serial = models.Integer() > >rented_to = models.ForeignKey(Customer) > >rental_due = models.DateField() > > > The Form should display the customer's name, phone number, and the > > movies the customer has rented, but *not* the date they're due > > ('cause I'd like this problem to represent real-world problems, where > > one doesn't necessarily display all the fields for editing). > > It sounds like you want the django.newforms.formsets capability that > isn't on trunk yet. There is an initial implementation in the > newforms-admin branch because they need it to implement edit-inline > equivalence in the new admin stuff, but it hasn't been completed yet > (based on the FIXMEs at the end of the file), so it isn't worth > committing it to trunk anyway. > > A little more patience will be required. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: WANTED: Demonstration of good FK & M2M form creation
On Sun, 2007-05-20 at 11:19 -0700, David Priest wrote: > I believe I have performed exhaustive research on the challenge of > creating forms that incorporate fields from multiple tables. I have > not found *any* comprehensive, best-practices examples of this problem. > > It really quite surprises me, as any web application of even moderate > complexity requires multiple tables. > > Anyway, I think everyone (and especially all us n00bs) would *really* > appreciate a good bit of demonstration code for the following sort of > scenario: > > class Customer(models.Model): > name = models.CharField() > phone = models.PhoneNumber() > > > class Rentals(models.Model): > title = models.CharField() > serial = models.Integer() > rented_to = models.ForeignKey(Customer) > rental_due = models.DateField() > > The Form should display the customer's name, phone number, and the > movies the customer has rented, but *not* the date they're due > ('cause I'd like this problem to represent real-world problems, where > one doesn't necessarily display all the fields for editing). It sounds like you want the django.newforms.formsets capability that isn't on trunk yet. There is an initial implementation in the newforms-admin branch because they need it to implement edit-inline equivalence in the new admin stuff, but it hasn't been completed yet (based on the FIXMEs at the end of the file), so it isn't worth committing it to trunk anyway. A little more patience will be required. Regards, Malcolm --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---