π§ FocusEdge – Baneshwor’s Most Trusted Academic Coaching Empowering Students from Grade 1 to 12 π Unlock Academic Brilliance with FocusEdge Personalized Learning | Expert Mentors | Proven Results
# backend/app.py
from flask import Flask, render_template, request, redirect
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///students.db'
db = SQLAlchemy(app)
class StudentInquiry(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
email = db.Column(db.String(100), nullable=False)
phone = db.Column(db.String(20), nullable=False)
grade = db.Column(db.String(10), nullable=False)
timestamp = db.Column(db.DateTime, default=datetime.utcnow)
def __repr__(self):
return f""
@app.route('/')
def index():
return render_template('index.html')
@app.route('/inquiry', methods=['POST'])
def inquiry():
name = request.form['name']
email = request.form['email']
phone = request.form['phone']
grade = request.form['grade']
new_inquiry = StudentInquiry(name=name, email=email, phone=phone, grade=grade)
db.session.add(new_inquiry)
db.session.commit()
return redirect('/')
if __name__ == '__main__':
app.run(debug=True)
# templates/index.html (Place your HTML content here with inquiry form)
# Add this snippet in a suitable place within the section of your HTML:
Comments
Post a Comment