[wip] added chapters

This commit is contained in:
Rushabh Mehta
2017-05-08 17:30:45 +05:30
parent 5ea10ff2fd
commit 4045f91cc6
13 changed files with 433 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{% extends "templates/web.html" %}
{% block page_content %}
{% if frappe.session.user=='Guest' %}
<p>Please signup and login to join this chapter</p>
<p><a href="/login" class='btn btn-primary'>Login</a></p>
{% else %}
<p>Welcome to chapter {{ chapter.title }}!</p>
<p><a href="/{{ chapter.route }}" class='btn btn-primary'>Go to Chapter Page</a></p>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,12 @@
import frappe
def get_context(context):
if frappe.session.user!='Guest':
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
if frappe.session.user not in [d.user for d in chapter.members]:
chapter.append('members', dict(user=frappe.session.user))
chapter.save()
frappe.db.commit()
context.chapter = chapter