-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.py
More file actions
19 lines (15 loc) · 811 Bytes
/
models.py
File metadata and controls
19 lines (15 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
db = SQLAlchemy()
class Lead(db.Model):
__tablename__ = "leads"
id = db.Column(db.Integer, primary_key=True)
form_type = db.Column(db.String(50), nullable=False)
name = db.Column(db.String(100), nullable=False)
email = db.Column(db.String(100), nullable=False)
phone = db.Column(db.String(20), nullable=True) # Optional (contact forms might not have it)
service = db.Column(db.String(100), nullable=True) # Project type (quote only)
message = db.Column(db.Text, nullable=False) # Contact message or project details
created_at = db.Column(db.DateTime, nullable = False, default=datetime.now)
def __repr__(self):
return f"<Lead id = {self.id} form_type = {self.form_type} name={self.name}>"