[website] [minor] moving to framework

This commit is contained in:
Anand Doshi
2013-09-10 13:46:15 +05:30
parent 429fd1d3d8
commit 330dae90cb
44 changed files with 382 additions and 417 deletions

View File

@@ -51,25 +51,3 @@ class DocType:
webnotes.conn.sql("""update `tabAddress` set `%s`=0 where `%s`=%s and name!=%s""" %
(is_address_type, fieldname, "%s", "%s"), (self.doc.fields[fieldname], self.doc.name))
break
def get_website_args():
def _get_fields(fieldnames):
return [webnotes._dict(zip(["label", "fieldname", "fieldtype", "options"],
[df.label, df.fieldname, df.fieldtype, df.options]))
for df in webnotes.get_doctype("Address", processed=True).get({"fieldname": ["in", fieldnames]})]
bean = None
if webnotes.form_dict.name:
bean = webnotes.bean("Address", webnotes.form_dict.name)
return {
"doc": bean.doc if bean else None,
"meta": webnotes._dict({
"left_fields": _get_fields(["address_title", "address_type", "address_line1", "address_line2",
"city", "state", "pincode", "country"]),
"right_fields": _get_fields(["email_id", "phone", "fax", "is_primary_address",
"is_shipping_address"])
}),
"cint": cint
}

View File

@@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% set title=doc and doc.name or "New Address" %}
{% set docname=(doc and doc.name or "") %}

View File

@@ -0,0 +1,28 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def get_context():
def _get_fields(fieldnames):
return [webnotes._dict(zip(["label", "fieldname", "fieldtype", "options"],
[df.label, df.fieldname, df.fieldtype, df.options]))
for df in webnotes.get_doctype("Address", processed=True).get({"fieldname": ["in", fieldnames]})]
bean = None
if webnotes.form_dict.name:
bean = webnotes.bean("Address", webnotes.form_dict.name)
return {
"doc": bean.doc if bean else None,
"meta": webnotes._dict({
"left_fields": _get_fields(["address_title", "address_type", "address_line1", "address_line2",
"city", "state", "pincode", "country"]),
"right_fields": _get_fields(["email_id", "phone", "fax", "is_primary_address",
"is_shipping_address"])
}),
"cint": cint
}

View File

@@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% set title="My Addresses" %}