diff options
| -rw-r--r-- | ishtar/furnitures/forms.py | 24 | ||||
| -rw-r--r-- | ishtar/furnitures/menus.py | 2 | ||||
| -rw-r--r-- | ishtar/furnitures/urls.py | 20 | ||||
| -rw-r--r-- | ishtar/furnitures/views.py | 9 | 
4 files changed, 31 insertions, 24 deletions
| diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index f0b891961..cb94e2889 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -396,6 +396,15 @@ _(u"Enter a valid name consisting of letters, spaces and hyphens."), 'invalid')  class PersonWizard(Wizard):      model = models.Person +class PersonFormSelection(forms.Form): +    form_label = _("Person") +    associated_models = {'pk':models.Person} +    currents = {'pk':models.Person} +    pk = forms.IntegerField(label=_("Person"), +         widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person'), +                                           associated_model=models.Person), +         validators=[models.valid_id(models.Person)]) +  class PersonForm(forms.Form):      form_label = _("Identity")      associated_models = {'attached_to':models.Organization, @@ -423,6 +432,12 @@ person_creation_wizard = PersonWizard([                          ('final-person_creation', FinalForm)],                           url_name='person_creation',) +person_modification_wizard = PersonWizard([ +                          ('selec-person_modification', PersonFormSelection), +                          ('identity-person_modification', PersonForm), +                          ('final-person_modification', FinalForm)], +                          url_name='person_modification',) +  class AccountWizard(Wizard):      model = models.Person      def get_formated_datas(self, forms): @@ -502,15 +517,6 @@ class AccountWizard(Wizard):          return form -class PersonFormSelection(forms.Form): -    form_label = _("Person") -    associated_models = {'pk':models.Person} -    currents = {'pk':models.Person} -    pk = forms.IntegerField(label=_("Person"), -         widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person'), -                                           associated_model=models.Person), -         validators=[models.valid_id(models.Person)]) -  class AccountForm(forms.Form):      form_label = _("Account")      associated_models = {'pk':models.Person} diff --git a/ishtar/furnitures/menus.py b/ishtar/furnitures/menus.py index 63bb85d58..2e15f6930 100644 --- a/ishtar/furnitures/menus.py +++ b/ishtar/furnitures/menus.py @@ -62,6 +62,8 @@ class Menu:              childs=[                  MenuItem('person_creation', _(u"Person creation"),                      access_controls=['add_person', 'add_own_person']), +                MenuItem('person_modification', _(u"Person modification"), +                    access_controls=['change_person', 'change_own_person']),                  MenuItem('account_management', _(u"Account management"),                      access_controls=['add_ishtaruser',]),              ]), diff --git a/ishtar/furnitures/urls.py b/ishtar/furnitures/urls.py index 01c8968a5..06c9c9f1e 100644 --- a/ishtar/furnitures/urls.py +++ b/ishtar/furnitures/urls.py @@ -21,25 +21,25 @@ from django.conf.urls.defaults import *  from ishtar.urls import BASE_URL  from menus import menu -from forms import file_creation_wizard, file_modification_wizard,\ -                  operation_creation_wizard, operation_modification_wizard,\ -                  person_creation_wizard, account_management_wizard +import forms as ishtar_forms  urlpatterns, actions = [], []  urlpatterns = patterns('',           url(BASE_URL + r'person_creation/(?P<step>.+)$', -                        person_creation_wizard, name='person_creation'), +           ishtar_forms.person_creation_wizard, name='person_creation'), +         url(BASE_URL + r'person_modification/(?P<step>.+)$', +           ishtar_forms.person_modification_wizard, name='person_modification'),           url(BASE_URL + r'account_management/(?P<step>.+)$', -                        account_management_wizard, name='account_management'), -         url(BASE_URL + r'file_creation/(?P<step>.+)$', file_creation_wizard, -                                             name='file_creation'), +           ishtar_forms.account_management_wizard, name='account_management'), +         url(BASE_URL + r'file_creation/(?P<step>.+)$', +           ishtar_forms.file_creation_wizard, name='file_creation'),           url(BASE_URL + r'file_modification/(?P<step>.+)$', -                    file_modification_wizard, name='file_modification'), +           ishtar_forms.file_modification_wizard, name='file_modification'),           url(BASE_URL + r'operation_creation/(?P<step>.+)$', -                    operation_creation_wizard, name='operation_creation'), +           ishtar_forms.operation_creation_wizard, name='operation_creation'),           url(BASE_URL + r'operation_modification/(?P<step>.+)$', -                  operation_modification_wizard, name='operation_modification'), +     ishtar_forms.operation_modification_wizard, name='operation_modification'),           )  for section in menu.childs:      for menu_item in section.childs: diff --git a/ishtar/furnitures/views.py b/ishtar/furnitures/views.py index 74b2461ec..3d7564a55 100644 --- a/ishtar/furnitures/views.py +++ b/ishtar/furnitures/views.py @@ -32,9 +32,7 @@ from django.core import serializers  from ishtar import settings  from menus import menu -from forms import file_creation_wizard, file_modification_wizard, \ -                  operation_creation_wizard, operation_modification_wizard, \ -                  person_creation_wizard, account_management_wizard +import forms as ishtar_forms  import models  def index(request): @@ -169,7 +167,8 @@ def action(request, action_slug, obj_id=None, *args, **kwargs):      globals_dct = globals()      if action_slug in globals_dct:          return globals_dct[action_slug](request, dct, obj_id, *args, **kwargs) -    elif action_slug + "_wizard" in globals_dct: -        return globals_dct[action_slug+"_wizard"](request, *args, **kwargs) +    elif hasattr(ishtar_forms, action_slug + "_wizard"): +        return getattr(ishtar_forms, action_slug+"_wizard")(request, *args, +                                                            **kwargs)      return render_to_response('index.html', dct,                                context_instance=RequestContext(request)) | 
