mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-16 18:00:47 +02:00
16 lines
408 B
Python
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
|