add code for creating new customers
* update string catalog and german translation (addresses #11) * create new actions for adding customers in customers controller (addresses #12) git-svn-id: file:///var/www/wwwusers/usr01/svn/pyalchemybiz/trunk@10 389c73d4-bf09-4d3d-a15e-f94a37d0667a
This commit is contained in:
parent
1bbcc8e559
commit
08b4d46c84
7 changed files with 92 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyalchemybiz.lib.base import *
|
from pyalchemybiz.lib.base import *
|
||||||
from pyalchemybiz.model import customer, meta
|
from pyalchemybiz.model import customer, meta, person
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -19,3 +19,19 @@ class CustomerController(BaseController):
|
||||||
cust_q = sess.query(customer.Customer)
|
cust_q = sess.query(customer.Customer)
|
||||||
c.customer = cust_q.filter(customer.Customer.id==id).one()
|
c.customer = cust_q.filter(customer.Customer.id==id).one()
|
||||||
return render('/customer/edit.mako')
|
return render('/customer/edit.mako')
|
||||||
|
|
||||||
|
def create(self):
|
||||||
|
sess = meta.Session()
|
||||||
|
return render('/customer/create.mako')
|
||||||
|
|
||||||
|
def create_process(self):
|
||||||
|
sess = meta.Session()
|
||||||
|
cust = customer.Customer()
|
||||||
|
sess.save(cust)
|
||||||
|
cust.person = person.Person()
|
||||||
|
cust.person.firstname = request.params['firstname']
|
||||||
|
cust.person.lastname = request.params['lastname']
|
||||||
|
sess.save(cust.person)
|
||||||
|
sess.commit()
|
||||||
|
|
||||||
|
redirect_to(action='index')
|
||||||
|
|
Binary file not shown.
|
@ -1,15 +1,15 @@
|
||||||
# German translations for pyalchemybiz.
|
# German translations for pyalchemybiz.
|
||||||
# Copyright (C) 2008 ORGANIZATION
|
# Copyright (C) 2008, 2009 Jan Dittberner
|
||||||
# This file is distributed under the same license as the pyalchemybiz
|
# This file is distributed under the same license as the pyalchemybiz
|
||||||
# project.
|
# project.
|
||||||
# Jan Dittberner <jan@dittberner.info>, 2008.
|
# Jan Dittberner <jan@dittberner.info>, 2009.
|
||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: pyalchemybiz 0.1\n"
|
"Project-Id-Version: pyalchemybiz 0.1\n"
|
||||||
"Report-Msgid-Bugs-To: jan@dittberner.info\n"
|
"Report-Msgid-Bugs-To: jan@dittberner.info\n"
|
||||||
"POT-Creation-Date: 2008-10-06 00:50+0200\n"
|
"POT-Creation-Date: 2008-10-06 00:50+0200\n"
|
||||||
"PO-Revision-Date: 2008-10-06 01:10+0200\n"
|
"PO-Revision-Date: 2009-01-18 23:31+0100\n"
|
||||||
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
|
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
|
||||||
"Language-Team: de <de@li.org>\n"
|
"Language-Team: de <de@li.org>\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||||
|
@ -19,6 +19,8 @@ msgstr ""
|
||||||
"Generated-By: Babel 0.9.1\n"
|
"Generated-By: Babel 0.9.1\n"
|
||||||
|
|
||||||
#: pyalchemybiz/controllers/index.py:11
|
#: pyalchemybiz/controllers/index.py:11
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:3
|
||||||
|
#: pyalchemybiz/templates/customer/index.mako:3
|
||||||
msgid "Customer management"
|
msgid "Customer management"
|
||||||
msgstr "Kundenverwaltung"
|
msgstr "Kundenverwaltung"
|
||||||
|
|
||||||
|
@ -35,11 +37,31 @@ msgstr "Zurück zur %s."
|
||||||
msgid "FrontPage"
|
msgid "FrontPage"
|
||||||
msgstr "Startseite"
|
msgstr "Startseite"
|
||||||
|
|
||||||
#: pyalchemybiz/templates/customer/index.mako:3
|
#: pyalchemybiz/templates/customer/create.mako:4
|
||||||
msgid "Hello"
|
msgid "Create new customer"
|
||||||
msgstr "Hallo"
|
msgstr "Neuen Kunden anlegen"
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:8
|
||||||
|
msgid "First name:"
|
||||||
|
msgstr "Vorname:"
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:10
|
||||||
|
msgid "Last name:"
|
||||||
|
msgstr "Nachname:"
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:13
|
||||||
|
#, fuzzy
|
||||||
|
msgid "Add new customer"
|
||||||
|
msgstr "Neuen Kunden hinzufügen"
|
||||||
|
|
||||||
#: pyalchemybiz/templates/customer/index.mako:7
|
#: pyalchemybiz/templates/customer/index.mako:7
|
||||||
msgid "edit"
|
msgid "edit customer"
|
||||||
msgstr "bearbeiten"
|
msgstr "Kunden bearbeiten"
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/index.mako:11
|
||||||
|
msgid "create new customer"
|
||||||
|
msgstr "neuen Kunden anlegen"
|
||||||
|
|
||||||
|
#~ msgid "Organization:"
|
||||||
|
#~ msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# Translations template for pyalchemybiz.
|
# Translations template for pyalchemybiz.
|
||||||
# Copyright (C) 2008 ORGANIZATION
|
# Copyright (C) 2009 ORGANIZATION
|
||||||
# This file is distributed under the same license as the pyalchemybiz project.
|
# This file is distributed under the same license as the pyalchemybiz project.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2008.
|
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
|
||||||
#
|
#
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: pyalchemybiz 0.1\n"
|
"Project-Id-Version: pyalchemybiz 0.1\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2008-10-06 01:10+0200\n"
|
"POT-Creation-Date: 2009-01-18 23:30+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -18,6 +18,8 @@ msgstr ""
|
||||||
"Generated-By: Babel 0.9.1\n"
|
"Generated-By: Babel 0.9.1\n"
|
||||||
|
|
||||||
#: pyalchemybiz/controllers/index.py:11
|
#: pyalchemybiz/controllers/index.py:11
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:3
|
||||||
|
#: pyalchemybiz/templates/customer/index.mako:3
|
||||||
msgid "Customer management"
|
msgid "Customer management"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -34,11 +36,27 @@ msgstr ""
|
||||||
msgid "FrontPage"
|
msgid "FrontPage"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pyalchemybiz/templates/customer/index.mako:3
|
#: pyalchemybiz/templates/customer/create.mako:4
|
||||||
msgid "Hello"
|
msgid "Create new customer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:8
|
||||||
|
msgid "First name:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:10
|
||||||
|
msgid "Last name:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/create.mako:13
|
||||||
|
msgid "Add new customer"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pyalchemybiz/templates/customer/index.mako:7
|
#: pyalchemybiz/templates/customer/index.mako:7
|
||||||
msgid "edit"
|
msgid "edit customer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: pyalchemybiz/templates/customer/index.mako:11
|
||||||
|
msgid "create new customer"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
<html>
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title>${_('PyAlchemyBiz')}</title>
|
<title>${_('PyAlchemyBiz')}</title>
|
||||||
${h.stylesheet_link_tag('/pyalchemybiz.css')}
|
${h.stylesheet_link_tag('/pyalchemybiz.css')}
|
||||||
|
|
15
pyalchemybiz/templates/customer/create.mako
Normal file
15
pyalchemybiz/templates/customer/create.mako
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<%inherit file="/base.mako" />
|
||||||
|
|
||||||
|
<h1>${_('Customer management')}</h1>
|
||||||
|
<h2>${_('Create new customer')}</h2>
|
||||||
|
|
||||||
|
${h.start_form(h.url_for(action='create_process'), method='post')}
|
||||||
|
<div id="createcustomerform">
|
||||||
|
<label for="firstname">${_('First name:')}</label><br />
|
||||||
|
${h.text_field('firstname')}<br />
|
||||||
|
<label for="lastname">${_('Last name:')}</label><br />
|
||||||
|
${h.text_field('lastname')}<br />
|
||||||
|
|
||||||
|
${h.submit(_('Add new customer'))}
|
||||||
|
</div>
|
||||||
|
${h.end_form()}
|
|
@ -1,9 +1,11 @@
|
||||||
<%inherit file="/base.mako" />
|
<%inherit file="/base.mako" />
|
||||||
|
|
||||||
<h1>${_('Hello')}</h1>
|
<h1>${_('Customer management')}</h1>
|
||||||
|
|
||||||
<ul id="customers">
|
<ul id="customers">
|
||||||
% for customer in c.customers:
|
% for customer in c.customers:
|
||||||
<li>${customer | h} [${h.link_to(_('edit'), h.url_for(id=customer.id, action="edit"))}]</li>
|
<li>${customer | h} [${h.link_to(_('edit customer'), h.url_for(id=customer.id, action="edit"))}]</li>
|
||||||
% endfor
|
% endfor
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
${h.link_to(_('create new customer'), h.url_for(action="create"))}
|
||||||
|
|
Loading…
Reference in a new issue