diff --git a/pyalchemybiz/controllers/customer.py b/pyalchemybiz/controllers/customer.py index eabdb72..ad62764 100644 --- a/pyalchemybiz/controllers/customer.py +++ b/pyalchemybiz/controllers/customer.py @@ -1,7 +1,7 @@ import logging from pyalchemybiz.lib.base import * -from pyalchemybiz.model import customer, meta +from pyalchemybiz.model import customer, meta, person log = logging.getLogger(__name__) @@ -19,3 +19,19 @@ class CustomerController(BaseController): cust_q = sess.query(customer.Customer) c.customer = cust_q.filter(customer.Customer.id==id).one() 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') diff --git a/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.mo b/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.mo index 28b70e6..1f577ba 100644 Binary files a/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.mo and b/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.mo differ diff --git a/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.po b/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.po index 9d354de..85007b6 100644 --- a/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.po +++ b/pyalchemybiz/i18n/de/LC_MESSAGES/pyalchemybiz.po @@ -1,15 +1,15 @@ # 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 # project. -# Jan Dittberner , 2008. +# Jan Dittberner , 2009. # msgid "" msgstr "" "Project-Id-Version: pyalchemybiz 0.1\n" "Report-Msgid-Bugs-To: jan@dittberner.info\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 \n" "Language-Team: de \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -19,6 +19,8 @@ msgstr "" "Generated-By: Babel 0.9.1\n" #: pyalchemybiz/controllers/index.py:11 +#: pyalchemybiz/templates/customer/create.mako:3 +#: pyalchemybiz/templates/customer/index.mako:3 msgid "Customer management" msgstr "Kundenverwaltung" @@ -35,11 +37,31 @@ msgstr "Zurück zur %s." msgid "FrontPage" msgstr "Startseite" -#: pyalchemybiz/templates/customer/index.mako:3 -msgid "Hello" -msgstr "Hallo" +#: pyalchemybiz/templates/customer/create.mako:4 +msgid "Create new customer" +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 -msgid "edit" -msgstr "bearbeiten" +msgid "edit customer" +msgstr "Kunden bearbeiten" + +#: pyalchemybiz/templates/customer/index.mako:11 +msgid "create new customer" +msgstr "neuen Kunden anlegen" + +#~ msgid "Organization:" +#~ msgstr "" diff --git a/pyalchemybiz/i18n/pyalchemybiz.pot b/pyalchemybiz/i18n/pyalchemybiz.pot index afe1aef..64f9a93 100644 --- a/pyalchemybiz/i18n/pyalchemybiz.pot +++ b/pyalchemybiz/i18n/pyalchemybiz.pot @@ -1,14 +1,14 @@ # Translations template for pyalchemybiz. -# Copyright (C) 2008 ORGANIZATION +# Copyright (C) 2009 ORGANIZATION # This file is distributed under the same license as the pyalchemybiz project. -# FIRST AUTHOR , 2008. +# FIRST AUTHOR , 2009. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: pyalchemybiz 0.1\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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,6 +18,8 @@ msgstr "" "Generated-By: Babel 0.9.1\n" #: pyalchemybiz/controllers/index.py:11 +#: pyalchemybiz/templates/customer/create.mako:3 +#: pyalchemybiz/templates/customer/index.mako:3 msgid "Customer management" msgstr "" @@ -34,11 +36,27 @@ msgstr "" msgid "FrontPage" msgstr "" -#: pyalchemybiz/templates/customer/index.mako:3 -msgid "Hello" +#: pyalchemybiz/templates/customer/create.mako:4 +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 "" #: pyalchemybiz/templates/customer/index.mako:7 -msgid "edit" +msgid "edit customer" +msgstr "" + +#: pyalchemybiz/templates/customer/index.mako:11 +msgid "create new customer" msgstr "" diff --git a/pyalchemybiz/templates/base.mako b/pyalchemybiz/templates/base.mako index b3f1cf4..6d6b36e 100644 --- a/pyalchemybiz/templates/base.mako +++ b/pyalchemybiz/templates/base.mako @@ -1,6 +1,6 @@ - - + ${_('PyAlchemyBiz')} ${h.stylesheet_link_tag('/pyalchemybiz.css')} diff --git a/pyalchemybiz/templates/customer/create.mako b/pyalchemybiz/templates/customer/create.mako new file mode 100644 index 0000000..4df4bae --- /dev/null +++ b/pyalchemybiz/templates/customer/create.mako @@ -0,0 +1,15 @@ +<%inherit file="/base.mako" /> + +

${_('Customer management')}

+

${_('Create new customer')}

+ +${h.start_form(h.url_for(action='create_process'), method='post')} +
+
+${h.text_field('firstname')}
+
+${h.text_field('lastname')}
+ +${h.submit(_('Add new customer'))} +
+${h.end_form()} diff --git a/pyalchemybiz/templates/customer/index.mako b/pyalchemybiz/templates/customer/index.mako index 58055e6..0885732 100644 --- a/pyalchemybiz/templates/customer/index.mako +++ b/pyalchemybiz/templates/customer/index.mako @@ -1,9 +1,11 @@ <%inherit file="/base.mako" /> -

${_('Hello')}

+

${_('Customer management')}

    % for customer in c.customers: -
  • ${customer | h} [${h.link_to(_('edit'), h.url_for(id=customer.id, action="edit"))}]
  • +
  • ${customer | h} [${h.link_to(_('edit customer'), h.url_for(id=customer.id, action="edit"))}]
  • % endfor
+ +${h.link_to(_('create new customer'), h.url_for(action="create"))}