This is still pretty WET for my tastes, but I do not completely understand your requirements. Programming is after all an art and a science. I have a tendendcy to normalize things as much as I feel is reasonable, perhaps it is more than you require. I would at least consider something like the following:(Beware: mixture of code and psuedo-code ahead!)
TITLES = ( ('Miss','Miss'), ('Mrs.','Mrs.'), ('Ms.','Ms.'), ('Mr.','Mr.'), ('Dr.','Dr.'), ('Prof.','Prof.'), ('Rev.','Rev.'), ) class TitleChoices(models.Model): name = models.CharField(maxlength=5) def __str__(self): return ('%s' % (self.name)) class Admin: pass class PhoneNumber(models.Model): type_choices = (('Home','Home'),('Mobile','Mobile'),('Work','Work')) phone = models.PhoneNumberField() type = charField(choices=type_choices) ext = models.CharField(maxlength=8,blank=True, null=True) class Address(models.Model): address = models.CharField(maxlength=80) city = models.CharField(maxlength=40) prov = models.CharField(maxlength=2) postal = models.CharField(maxlength=7) MemberProfile: children = models.PositiveSmallIntegerField() inv_knoledge = models.PositiveSmallIntegerField() risk_tol = models.PositiveSmallIntegerField() total_income = models.PositiveSmallIntegerField() networth = models.PositiveSmallIntegerField() borrowed = models.BooleanField() add_info = models.CharField(maxlength=80) def __str__(self): return '%s %s %s' % (self.title, self.f_name, self.l_name) class Admin: pass class Member(models.Model): parent = FK('self', null=True, blank=True) # This is just a guess member_profile = FK(MemberProfile) title = models.ForeignKey(TitleChoices) f_name = models.CharField(maxlength=30) l_name = models.CharField(maxlength=40) b_date = models.DateField() relation = models.CharField(maxlength=40) #Not sure what this is. sin = models.CharField(maxlength=15) #Not sure what this is (outside of math and eternal damnation) phone_numbers = M2M(PhoneNumber) address = FK(Address) email = models.EmailField() work = models.CharField(maxlength=80) job = models.CharField(maxlength=40) class Plan(models.Model) member = FK(Member, related_name='member') joint_member = FK(Member, related_name='joint', null=True,blank=True) ---------- OR ---------- class Plan(models.Model): members = M2M(Member) hth, -richard On 5/22/08, Lance F. Squire <[EMAIL PROTECTED]> wrote: > > > Currently, I'm working from the demos in the book and the site. > > Here is what I have currently. > > forms.py: > > from django import newforms as forms > from django.newforms import form_for_model > from models import PlanMember > > > ApplicationForm = form_for_model(PlanMember) > > --- > > views.py: > > # Create your views here. > from django.db.models import Q > from django.shortcuts import render_to_response > #from models import PlanMember > from forms import ApplicationForm > > #def index(): > # return render_to_responce('index.html') > > def application(request): > if request.method == 'POST': > form = ApplicationForm(request.POST) > if form.is_valid(): > form.save() > return HttpResponseRedirect('/add_publisher/thanks/') > else: > form = ApplicationForm() > return render_to_response('application.html', {'form': form}) > > --- > > models.py: > > from django.db import models > > > # Create your models here. > > # Joint applicant > j_title = models.CharField(maxlength=7) > j_f_name = models.CharField(maxlength=30) > j_l_name = models.CharField(maxlength=40) > j_b_date = models.DateField() > j_relation = models.CharField(maxlength=40) > j_sin = models.CharField(maxlength=15) > j_email = models.EmailField() > j_work = models.CharField(maxlength=80) > j_job = models.CharField(maxlength=40) > > # Parrent info > p_title = models.CharField(maxlength=7) > p_f_name = models.CharField(maxlength=30) > P_l_name = models.CharField(maxlength=40) > p_h_phone = models.PhoneNumberField() > p_c_phone = models.PhoneNumberField() > p_b_phone = models.PhoneNumberField() > p_b_p_ext = models.CharField(maxlength=8) > p_address = models.CharField(maxlength=80) > p_city = models.CharField(maxlength=40) > p_prov = models.CharField(maxlength=2) > p_postal = models.CharField(maxlength=7) > > # --- > > Joint applicant, Parrent and MemberProfile were originally individual > tables. But in trying to make it DRY, and get all the fields I wanted > on the same form, I joined them together. They really all need to be > stored at the same time anyway. > > I've temporarily changed all but the first 'title' back from a foreign > key to a charfield just to get it to render at all. > > Lance > On May 21, 7:41 pm, "Adam Gomaa" <[EMAIL PROTECTED]> wrote: > > Lance, it's also not clear to me what exactly you need. Are you using > > ModelForm? If not, what do you mean by the 'auto generated' form? I > > think I have a rough idea what you're looking for, but a few more details > > would go a long way. > > > > Adam > > > > On Wed, May 21, 2008 at 3:30 PM, Lance F. Squire <[EMAIL PROTECTED]> > wrote: > > > > > > > > > I'm trying to make a Form where 3 people need to be inputed. All three > > > need to have a Title.(EG. Mr. Mrs. etc.) > > > > > I tried making the Title fields in the database be a key to a table of > > > title selections. The sql generation had no trouble with that, but the > > > Form generator doesn't like it at all... > > > > > I had them as character fields, but couldn't figure out how to get > > > them to become select/choice fields after the form was auto generated > > > from the table, before the view... > > > > > I'm new to Django. Played with Rails some, but mostly work in Perl/ > > > Postgres > > > > > Also looked at having the people in separate tables, but it didn't > > > seem practical either from a filling in data point or a rendering/ > > > parching the form point. > > > > > Thanks for any help and/or pointers. > > > Lance > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---