I have the following models and I'd like to use them to generate a
contact form...now I know I'm suppossed to use inline formsets, but
I've never been able to make heads or tails of how to make this
work...I want to have the first name, last name, email, phone number,
best time to contact, and the message in my view.  How should I go
about this?

class BestTime(models.Model):
  contact_time = models.CharField(max_length=20)
  start_time = models.TimeField()
  end_time = models.TimeField()
  def __unicode__(self):
    return self.contact_time

class Customer(models.Model):
  date_time_added = models.DateTimeField(default=datetime.today)
  first_name = models.CharField(max_length=20)
  last_name = models.CharField(max_length=20)
  email_address = models.CharField(max_length=75)
  phone_number = models.CharField(max_length=20)
  best_time_to_contact = models.ForeignKey(BestTime)
  def __unicode__(self):
     return self.first_name

class MessageType(models.Model):
  type = models.CharField(max_length=20)
  def __unicode__(self):
     return self.type

class Message(models.Model):
  date_time_added = models.DateTimeField(default=datetime.today)
  message_type = models.ForeignKey(MessageType)
  customer = models.ForeignKey(Customer)
  message = models.TextField()
  def __unicode__(self):
    return self.date_time_added

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to