Page MenuHomePhabricator
Paste P1912

django form save method example
ActivePublic

Authored by adambcooley on Dec 27 2015, 4:20 AM.
Tags
None
Referenced Files
F1045328: django form save method example
Dec 27 2015, 4:26 AM
F1045322: django form save method example
Dec 27 2015, 4:20 AM
Subscribers
None
class Registration(models.Model):
def __unicode__(self):
return str(self.id)
BusinessName = models.CharField("Business Name", max_length=100, null=True, blank=True)
FirstName = models.CharField("First Name", max_length=100)
LastName = models.CharField("Last Name", max_length=100)
Email = models.EmailField("Email")
Telephone = models.IntegerField("Telephone")
TextUpdate = models.BooleanField("Text Update", default=False)
Address1 = models.CharField("Address1", max_length=100)
Address2 = models.CharField("Address2", max_length=100, null=True, blank=True)
City = models.CharField("City", max_length=100)
State = models.ForeignKey(State, default="IA")
Zip = models.IntegerField("Zip Code")
Note = models.TextField("Note", max_length=500, blank=True)
Created = models.DateTimeField("Created", auto_now=True)
Updated = models.DateTimeField("Updated", auto_now_add=True)
profile_obj = Registration.objects.create(
BusinessName=BusinessName,
FirstName=FirstName,
Telephone=Telephone,
Address1=Address1,
Address2=Address2,
City=City,
State=State,
Zip=Zip,
Note=Note,
email=email,
Created=Created,
Updated=Updated
)