I'm making a one-page web-app which has one table.. that accepts
suggestions (like a feeback thingie)..
I'm using SQLFORM to render the form and accept and it's adding everything
in the database as expected. But I would like to do an additional step upon
submission of form.
I want to send an email with the form's contents to an admin's email id
with a reply to of the person who sent in the suggestion. How can i
configure this on a windows server..
Here's the code so far:
db.py:
db = DAL('sqlite://storage.db')
db.define_table('suggestions',
Field('type', requires=IS_IN_SET(['شكوى', 'مقترح'])),
Field('created_on', 'datetime', default=request.now),
Field('Name', 'string', notnull=True),
Field('Gender', requires=IS_IN_SET(['انثى', 'ذكر'])),
Field('Description', 'text'),
Field('email', requires=IS_EMAIL(error_message='Invalid Email !')),
Field('usercat', requires=IS_IN_SET(['فرد', 'مكتب عقاري'])),
Field('education', requires=IS_IN_SET(['ابتدائي', 'ثانوي', 'دبلوم',
'جامعي', 'دراسات عليا'])),
Field('homenumber', 'integer'),
Field('mobilenumber', 'integer'),
Field('age', 'integer'),
Field('pobox', 'integer'),
Field('nationality', 'string'),)
default.py
def viewall():
recs = db().select(db.suggestions.ALL,
orderby=db.suggestions.created_on)
return dict(recs=recs)
def index():
form =
SQLFORM(db.suggestions,labels={'type':'نوع','created_on':'التاريخ','Name':'الأسم','Gender':'الجنس','Description':'موضوع','email':'E-Mail','usercat':'نوع
المتعامل','education':'المؤهل العلمي','homenumber':'هاتف
منزل','mobilenumber':'هاتف متحرك','age':'العمر','pobox':'صندوق
بريد','nationality':'الجنسية'},submit_button='إرسل')
if form.process().accepted:
response.flash = 'تم ألإرسال'
elif form.errors:
response.flash = 'يرجى ملء كافة الحقول'
else:
pass
return dict(form=form)
default/index.html:
{{extend 'layout.html'}}
<img width="900" src="{{=URL('Suggestions', 'static', 'topbanner.png')}}"
/><h3 align="center">إقترحات و شكاوة</h3>
<hr>
{{=form}}
--