Files
foundation/foundation/www/user_intro.py
2017-05-15 14:57:16 +05:30

16 lines
408 B
Python

import frappe
def get_context(context):
context.no_cache = True
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
print chapter
if frappe.session.user!='Guest':
if chapter in [d.name for d in chapter]:
context.already_member = True
else:
chapter.append('members', dict(user=frappe.session.user))
chapter.save(ignore_permissions=1)
frappe.db.commit()
context.chapter = chapter