diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/fixtures/groups_person_types-SRA-fr.json | 67 | ||||
-rw-r--r-- | ishtar_common/forms.py | 26 | ||||
-rw-r--r-- | ishtar_common/forms_common.py | 13 | ||||
-rw-r--r-- | ishtar_common/locale/fr/LC_MESSAGES/django.po | 180 | ||||
-rw-r--r-- | ishtar_common/models.py | 20 | ||||
-rw-r--r-- | ishtar_common/ooo_replace.py | 32 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/wizard/confirm_wizard.html | 7 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/wizard/wizard_done.html | 5 | ||||
-rw-r--r-- | ishtar_common/views.py | 6 |
9 files changed, 245 insertions, 111 deletions
diff --git a/ishtar_common/fixtures/groups_person_types-SRA-fr.json b/ishtar_common/fixtures/groups_person_types-SRA-fr.json index e758bd645..9a43072b2 100644 --- a/ishtar_common/fixtures/groups_person_types-SRA-fr.json +++ b/ishtar_common/fixtures/groups_person_types-SRA-fr.json @@ -252,6 +252,37 @@ } }, { + "pk": 25, + "model": "auth.group", + "fields": { + "name": "Organisations : voir", + "permissions": [ + 246 + ] + } + }, + { + "pk": 26, + "model": "auth.group", + "fields": { + "name": "Organisations : modification/suppression", + "permissions": [ + 44, + 45 + ] + } + }, + { + "pk": 27, + "model": "auth.group", + "fields": { + "name": "Organisations : ajout", + "permissions": [ + 43 + ] + } + }, + { "pk": 7, "model": "ishtar_common.persontype", "fields": { @@ -281,23 +312,23 @@ "available": true, "txt_idx": "sra_agent", "groups": [ - 1, - 2, - 4, - 5, - 6, - 7, - 8, - 9, 10, 13, - 14, 15, - 16, + 14, 17, + 16, 18, - 21, - 22 + 22, + 1, + 2, + 5, + 4, + 7, + 6, + 9, + 8, + 21 ], "label": "Agent SRA (prescripteur)" } @@ -343,17 +374,23 @@ "available": true, "txt_idx": "secretarial_dept", "groups": [ - 1, 2, - 6, + 1, + 3, 7, + 6, 8, 9, 10, 13, 14, 17, - 18 + 18, + 23, + 24, + 25, + 26, + 27 ], "label": "Secr\u00e9tariat SRA" } diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index e82a6e86d..5faa232fb 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -145,3 +145,29 @@ def get_form_selection(class_name, label, key, model, base_form, get_url, return cleaned_data attrs['clean'] = clean return type(class_name, (forms.Form,), attrs) + +class DocumentGenerationForm(forms.Form): + """ + Form to generate document by choosing the template + """ + _associated_model = None # ex: AdministrativeAct + _associated_object_name = '' # ex: 'archaeological_operations.models.AdministrativeAct' + document_template = forms.ChoiceField(label=_("Template"), choices=[]) + + def __init__(self, *args, **kwargs): + super(DocumentGenerationForm, self).__init__(*args, **kwargs) + self.fields['document_template'].choices = \ + models.DocumentTemplate.get_tuples( + dct={'associated_object_name':self._associated_object_name}) + + def save(self, object_pk): + try: + c_object = self._associated_model.objects.get(pk=object_pk) + except self._associated_model.DoesNotExist: + return + try: + template = models.DocumentTemplate.objects.get( + pk=self.cleaned_data.get('document_template')) + except models.DocumentTemplate.DoesNotExist: + return + return template.publish(c_object) diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 661709a09..b6cab8b6a 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -124,7 +124,7 @@ class PersonFormSelection(forms.Form): PersonSelect, models.Person), validators=[models.valid_id(models.Person)]) -class PersonForm(forms.Form): +class SimplePersonForm(forms.Form): form_label = _("Identity") associated_models = {'attached_to':models.Organization} title = forms.ChoiceField(label=_("Title"), choices=models.Person.TYPE) @@ -132,6 +132,15 @@ class PersonForm(forms.Form): validators=[name_validator]) name = forms.CharField(label=_(u"Name"), max_length=30, validators=[name_validator]) + address = forms.CharField(label=_(u"Address"), widget=forms.Textarea, + required=False) + address_complement = forms.CharField(label=_(u"Address complement"), + widget=forms.Textarea, required=False) + postal_code = forms.CharField(label=_(u"Postal code"), max_length=10, + required=False) + town = forms.CharField(label=_(u"Town"), max_length=30, required=False) + country = forms.CharField(label=_(u"Country"), max_length=30, + required=False) email = forms.CharField(label=_(u"Email"), max_length=40, required=False, validators=[validators.validate_email]) attached_to = forms.IntegerField(label=_("Current organization"), @@ -139,6 +148,8 @@ class PersonForm(forms.Form): reverse_lazy('autocomplete-organization'), associated_model=models.Organization, new=True), validators=[models.valid_id(models.Organization)], required=False) + +class PersonForm(SimplePersonForm): person_types = forms.MultipleChoiceField(label=_("Person type"), choices=[], widget=forms.CheckboxSelectMultiple) diff --git a/ishtar_common/locale/fr/LC_MESSAGES/django.po b/ishtar_common/locale/fr/LC_MESSAGES/django.po index f6da52ee3..cb8cd135c 100644 --- a/ishtar_common/locale/fr/LC_MESSAGES/django.po +++ b/ishtar_common/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: alpha\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-28 21:37+0100\n" +"POT-Creation-Date: 2013-12-02 20:33+0100\n" "PO-Revision-Date: 2010-12-09\n" "Last-Translator: Étienne Loks <etienne.loks at peacefrogs net>\n" "Language-Team: \n" @@ -68,8 +68,8 @@ msgstr "Vous devez sélectionner un élément." msgid "Add a new item" msgstr "Ajouter un nouvel élément" -#: forms_common.py:42 forms_common.py:80 forms_common.py:84 models.py:613 -#: models.py:836 templates/ishtar/sheet_person.html:19 +#: forms_common.py:42 forms_common.py:80 forms_common.py:84 models.py:667 +#: models.py:896 templates/ishtar/sheet_person.html:19 #: templates/ishtar/sheet_person.html:29 msgid "Town" msgstr "Commune" @@ -92,63 +92,63 @@ msgstr "" "<p class='example'>Par exemple tapez « saint denis 93 » pour obtenir la " "commune Saint-Denis dans le département français de Seine-Saint-Denis.</p>" -#: forms_common.py:56 forms_common.py:296 ishtar_menu.py:29 models.py:675 -#: models.py:727 models.py:761 templates/ishtar/sheet_person.html:6 +#: forms_common.py:56 forms_common.py:296 ishtar_menu.py:29 models.py:730 +#: models.py:787 models.py:821 templates/ishtar/sheet_person.html:6 msgid "Person" msgstr "Individu" -#: forms_common.py:70 forms_common.py:104 forms_common.py:133 models.py:631 -#: models.py:668 models.py:822 templates/ishtar/sheet_person.html:12 -#: templates/ishtar/sheet_person.html:25 +#: forms_common.py:70 forms_common.py:104 forms_common.py:133 models.py:617 +#: models.py:685 models.py:723 models.py:882 +#: templates/ishtar/sheet_person.html:12 templates/ishtar/sheet_person.html:25 msgid "Name" msgstr "Nom" -#: forms_common.py:72 models.py:626 +#: forms_common.py:72 models.py:680 msgid "Organization type" msgstr "Type d'organisation" -#: forms_common.py:74 models.py:608 templates/ishtar/sheet_person.html:16 +#: forms_common.py:74 models.py:662 templates/ishtar/sheet_person.html:16 #: templates/ishtar/sheet_person.html:26 msgid "Address" msgstr "Adresse" -#: forms_common.py:76 models.py:609 templates/ishtar/sheet_person.html:17 +#: forms_common.py:76 models.py:663 templates/ishtar/sheet_person.html:17 #: templates/ishtar/sheet_person.html:27 msgid "Address complement" msgstr "Complément d'adresse" -#: forms_common.py:78 models.py:611 templates/ishtar/sheet_person.html:18 +#: forms_common.py:78 models.py:665 templates/ishtar/sheet_person.html:18 #: templates/ishtar/sheet_person.html:28 msgid "Postal code" msgstr "Code postal" -#: forms_common.py:81 models.py:614 +#: forms_common.py:81 models.py:668 msgid "Country" msgstr "Pays" -#: forms_common.py:83 models.py:616 templates/ishtar/sheet_person.html:20 +#: forms_common.py:83 models.py:670 templates/ishtar/sheet_person.html:20 #: templates/ishtar/sheet_person.html:30 msgid "Phone" msgstr "Téléphone" -#: forms_common.py:105 forms_common.py:131 models.py:666 +#: forms_common.py:105 forms_common.py:131 models.py:721 #: templates/ishtar/sheet_person.html:13 msgid "Surname" msgstr "Prénom" -#: forms_common.py:106 forms_common.py:135 forms_common.py:182 models.py:669 +#: forms_common.py:106 forms_common.py:135 forms_common.py:182 models.py:724 #: templates/ishtar/sheet_person.html:14 msgid "Email" msgstr "Courriel" -#: forms_common.py:107 models.py:633 models.py:785 templates/sheet_ope.html:85 +#: forms_common.py:107 models.py:687 models.py:845 templates/sheet_ope.html:85 #: templates/sheet_ope.html.py:105 templates/sheet_ope.html:126 #: templates/ishtar/sheet_person.html:41 templates/ishtar/sheet_person.html:94 #: templates/ishtar/blocks/window_tables/documents.html:6 msgid "Type" msgstr "Type" -#: forms_common.py:108 models.py:636 +#: forms_common.py:108 models.py:690 msgid "Organization" msgstr "Organisation" @@ -160,7 +160,7 @@ msgstr "Recherche d'individus" msgid "Identity" msgstr "Identité" -#: forms_common.py:130 forms_common.py:253 models.py:665 models.py:784 +#: forms_common.py:130 forms_common.py:253 models.py:720 models.py:844 #: templates/sheet_ope.html:104 templates/ishtar/sheet_person.html:93 #: templates/ishtar/blocks/window_tables/documents.html:5 msgid "Title" @@ -170,7 +170,7 @@ msgstr "Titre" msgid "Current organization" msgstr "Organisation actuelle" -#: forms_common.py:142 forms_common.py:164 forms_common.py:167 models.py:653 +#: forms_common.py:142 forms_common.py:164 forms_common.py:167 models.py:707 msgid "Person type" msgstr "Type d'individu" @@ -202,7 +202,7 @@ msgstr "Ce nom d'utilisateur existe déjà." msgid "Send the new password by email?" msgstr "Envoyer le nouveau mot de passe par courriel ?" -#: forms_common.py:233 forms_common.py:245 models.py:837 +#: forms_common.py:233 forms_common.py:245 models.py:897 #: templates/ishtar/sheet_person.html:71 msgid "Towns" msgstr "Communes" @@ -215,23 +215,23 @@ msgstr "Il y a des communes identiques." msgid "Documentation informations" msgstr "Information sur le document" -#: forms_common.py:255 forms_common.py:274 models.py:780 +#: forms_common.py:255 forms_common.py:274 models.py:840 msgid "Source type" msgstr "Type de source" -#: forms_common.py:257 models.py:789 +#: forms_common.py:257 models.py:849 msgid "Numerical ressource (web address)" msgstr "Ressource numérique (adresse web)" -#: forms_common.py:258 models.py:791 +#: forms_common.py:258 models.py:851 msgid "Receipt date" msgstr "Date de réception" -#: forms_common.py:260 models.py:793 +#: forms_common.py:260 models.py:853 msgid "Creation date" msgstr "Date de création" -#: forms_common.py:271 forms_common.py:290 forms_common.py:320 models.py:766 +#: forms_common.py:271 forms_common.py:290 forms_common.py:320 models.py:826 msgid "Author" msgstr "Auteur" @@ -239,7 +239,7 @@ msgstr "Auteur" msgid "Would you like to delete this documentation?" msgstr "Voulez vous supprimer ce document ?" -#: forms_common.py:297 models.py:757 models.py:763 +#: forms_common.py:297 models.py:817 models.py:823 msgid "Author type" msgstr "Type d'auteur" @@ -251,7 +251,7 @@ msgstr "Sélection d'auteur" msgid "There are identical authors." msgstr "Il y a des auteurs identiques." -#: forms_common.py:330 models.py:767 models.py:786 +#: forms_common.py:330 models.py:827 models.py:846 #: templates/sheet_ope.html:106 #: templates/ishtar/blocks/window_tables/documents.html:7 msgid "Authors" @@ -273,192 +273,212 @@ msgstr "Modification" msgid "Account management" msgstr "Gestion des comptes" -#: models.py:96 +#: models.py:115 msgid "Not a valid item." msgstr "Élément invalide." -#: models.py:108 +#: models.py:127 msgid "An item selected is not a valid item." msgstr "Un élément sélectionné n'est pas valide." -#: models.py:118 +#: models.py:137 msgid "This item already exist." msgstr "Cet élément existe déjà." -#: models.py:170 models.py:487 models.py:596 +#: models.py:189 models.py:506 models.py:650 msgid "Label" msgstr "Libellé" -#: models.py:171 +#: models.py:190 msgid "Textual ID" msgstr "Identifiant textuel" -#: models.py:173 +#: models.py:192 msgid "Comment" msgstr "Commentaire" -#: models.py:174 +#: models.py:193 models.py:621 msgid "Available" msgstr "Disponible" -#: models.py:340 +#: models.py:359 msgid "Last editor" msgstr "Dernier éditeur" -#: models.py:475 models.py:486 +#: models.py:494 models.py:505 msgid "URL name" msgstr "Nom de l'URL" -#: models.py:477 models.py:485 +#: models.py:496 models.py:504 msgid "Wizard" msgstr "Assistant" -#: models.py:484 +#: models.py:503 msgid "Order" msgstr "Ordre" -#: models.py:489 +#: models.py:508 msgid "Wizard step" msgstr "Étape de l'assistant" -#: models.py:532 templates/sheet_ope.html:61 templates/sheet_ope.html.py:83 +#: models.py:551 templates/sheet_ope.html:61 templates/sheet_ope.html.py:83 #: templates/ishtar/sheet_person.html:38 templates/ishtar/sheet_person.html:67 #: templates/ishtar/sheet_person.html:92 msgid "Year" msgstr "Année" -#: models.py:535 models.py:597 +#: models.py:554 models.py:651 #: templates/ishtar/dashboards/dashboard_main.html:74 msgid "Number" msgstr "Nombre" -#: models.py:600 +#: models.py:616 +msgid "Administrative Act" +msgstr "Acte administratif" + +#: models.py:618 +msgid "Template" +msgstr "Patron" + +#: models.py:619 +msgid "Associated object" +msgstr "Objet associé" + +#: models.py:624 +msgid "Document template" +msgstr "Patron de document" + +#: models.py:625 +msgid "Document templates" +msgstr "Patrons de documents" + +#: models.py:654 msgid "Department" msgstr "Département" -#: models.py:601 +#: models.py:655 msgid "Departments" msgstr "Départements" -#: models.py:617 templates/ishtar/sheet_person.html:21 +#: models.py:671 templates/ishtar/sheet_person.html:21 #: templates/ishtar/sheet_person.html:31 msgid "Mobile phone" msgstr "Téléphone portable" -#: models.py:627 +#: models.py:681 msgid "Organization types" msgstr "Types d'organisation" -#: models.py:637 +#: models.py:691 msgid "Organizations" msgstr "Organisations" -#: models.py:639 +#: models.py:693 msgid "Can view all Organization" msgstr "Peut voir toutes les Organisations" -#: models.py:640 +#: models.py:694 msgid "Can view own Organization" msgstr "Peut voir sa propre Organisation" -#: models.py:641 +#: models.py:695 msgid "Can add own Organization" msgstr "Peut ajouter sa propre Organisation" -#: models.py:642 +#: models.py:696 msgid "Can change own Organization" msgstr "Peut changer sa propre Organisation" -#: models.py:643 +#: models.py:697 msgid "Can delete own Organization" msgstr "Peut supprimer sa propre Organisation" -#: models.py:651 +#: models.py:705 msgid "Groups" msgstr "Groupes" -#: models.py:654 +#: models.py:708 msgid "Person types" msgstr "Types d'individu" -#: models.py:658 +#: models.py:713 msgid "Mr" -msgstr "M" +msgstr "M." -#: models.py:659 +#: models.py:714 msgid "Miss" msgstr "Mlle" -#: models.py:660 +#: models.py:715 msgid "Mrs" msgstr "Mme" -#: models.py:661 +#: models.py:716 msgid "Doctor" -msgstr "Dr" +msgstr "Dr." -#: models.py:670 models.py:691 +#: models.py:725 models.py:751 msgid "Types" msgstr "Types" -#: models.py:672 +#: models.py:727 msgid "Is attached to" msgstr "Est rattaché à" -#: models.py:676 +#: models.py:731 msgid "Persons" msgstr "Individus" -#: models.py:678 +#: models.py:733 msgid "Can view all Person" msgstr "Peut voir toutes les Personnes" -#: models.py:679 +#: models.py:734 msgid "Can view own Person" msgstr "Peut voir sa propre Personne" -#: models.py:680 +#: models.py:735 msgid "Can add own Person" msgstr "Peut ajouter sa propre Personne" -#: models.py:681 +#: models.py:736 msgid "Can change own Person" msgstr "Peut changer sa propre Personne" -#: models.py:682 +#: models.py:737 msgid "Can delete own Person" msgstr "Peut supprimer sa propre Personne" -#: models.py:731 +#: models.py:791 msgid "Ishtar user" msgstr "Utilisateur d'Ishtar" -#: models.py:732 +#: models.py:792 msgid "Ishtar users" msgstr "Utilisateurs d'Ishtar" -#: models.py:758 +#: models.py:818 msgid "Author types" msgstr "Types d'auteur" -#: models.py:781 +#: models.py:841 msgid "Source types" msgstr "Types de source" -#: models.py:794 templates/ishtar/sheet_person.html:39 +#: models.py:854 templates/ishtar/sheet_person.html:39 #: templates/ishtar/sheet_person.html:66 msgid "Ref." msgstr "Réf." -#: models.py:796 +#: models.py:856 msgid "Internal reference" msgstr "Référence interne" -#: models.py:823 +#: models.py:883 msgid "Surface (m²)" msgstr "Area (m²)" -#: models.py:824 templates/sheet_ope.html:46 templates/sheet_ope.html.py:107 +#: models.py:884 templates/sheet_ope.html:46 templates/sheet_ope.html.py:107 msgid "Localisation" msgstr "Localisation" @@ -496,19 +516,19 @@ msgstr "Opération non permise" msgid "New %s" msgstr "Nouveau %s" -#: views.py:624 +#: views.py:621 msgid "Archaeological files" msgstr "Dossiers archéologiques" -#: views.py:627 +#: views.py:624 msgid "Operations" msgstr "Opérations" -#: views.py:630 +#: views.py:627 msgid "Context records" msgstr "Unité d'Enregistrement" -#: views.py:633 +#: views.py:630 msgid "Finds" msgstr "Mobilier" diff --git a/ishtar_common/models.py b/ishtar_common/models.py index aacc9f2d0..76ffb761f 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -76,6 +76,15 @@ class ValueGetter(object): values[prefix + field_name] = value return values + @classmethod + def get_empty_values(cls, prefix=''): + if not prefix: + prefix = self._prefix + values = {} + for field_name in cls._meta.get_all_field_names(): + values[prefix + field_name] = '' + return values + class HistoricalRecords(BaseHistoricalRecords): def create_historical_record(self, instance, type): history_modifier = getattr(instance, 'history_modifier', None) @@ -650,7 +659,7 @@ class DocumentTemplate(models.Model): def publish(self, c_object): tempdir = tempfile.mkdtemp("-ishtardocs") output_name = tempdir + os.path.sep + \ - self.name.replace(' ', '_').lower() + u'-' +\ + slugify(self.name.replace(' ', '_').lower()) + u'-' +\ datetime.date.today().strftime('%Y-%m-%d') +\ u"." + self.template.name.split('.')[-1] missing = ooo_replace(self.template, output_name, c_object.get_values()) @@ -691,7 +700,7 @@ class OrganizationType(GeneralType): verbose_name_plural = _(u"Organization types") ordering = ('label',) -class Organization(Address, OwnPerms): +class Organization(Address, OwnPerms, ValueGetter): name = models.CharField(_(u"Name"), max_length=100) organization_type = models.ForeignKey(OrganizationType, verbose_name=_(u"Type")) @@ -753,6 +762,13 @@ class Person(Address, OwnPerms, ValueGetter) : if getattr(self, attr)] return u" ".join(values) + def get_values(self, prefix=''): + values = super(Person, self).get_values(prefix=prefix) + values[prefix+'title'] = dict(self.TYPE)[self.title] + if not self.attached_to: + values.update(Person.get_empty_values(prefix=prefix + 'attached_to_')) + return values + person_types_list_lbl = _(u"Types") @property def person_types_list(self): diff --git a/ishtar_common/ooo_replace.py b/ishtar_common/ooo_replace.py index 63b983b7b..d929d9359 100644 --- a/ishtar_common/ooo_replace.py +++ b/ishtar_common/ooo_replace.py @@ -17,26 +17,28 @@ # See the file COPYING for details. - +import locale from zipfile import ZipFile, ZIP_DEFLATED from cStringIO import StringIO from xml.etree.cElementTree import ElementTree, fromstring +from django.conf import settings + OOO_NS = "{urn:oasis:names:tc:opendocument:xmlns:text:1.0}" -def _set_value_from_formula(value, context): +def _set_value_from_formula(value, context, default_value): value = value.strip() if value.startswith("ooow:") and len(value) >= 5: value = value[5:] if value.startswith('"') and value.endswith('"') and len(value) > 1: value = value[1:-1] elif value in context: - value = unicode(context[value]) + value = _format_value(context[value], default_value) else: value = None return value -def _parse_condition(condition, context): +def _parse_condition(condition, context, default_value): # parse only == and != operator operator = "" if "!=" in condition: @@ -46,17 +48,28 @@ def _parse_condition(condition, context): else: return var1, var2 = condition.split(operator) - var1 = _set_value_from_formula(var1, context) - var2 = _set_value_from_formula(var2, context) + var1 = _set_value_from_formula(var1, context, default_value) + var2 = _set_value_from_formula(var2, context, default_value) res = var1 == var2 if operator == '!=': res = not res return res def _format_value(value, default_value): + if hasattr(value, 'strftime'): + c_locale = settings.LANGUAGE_CODE.split('-') + if len(c_locale) == 2: + c_locale[1] = c_locale[1].upper() + c_locale = "_".join(c_locale) + if locale.getlocale()[0] != c_locale: + locale.setlocale(locale.LC_ALL, c_locale) + if settings.DATE_FORMAT: + value = unicode(value.strftime(settings.DATE_FORMAT).decode( + locale.getlocale()[1]).lower()) + else: + value = unicode(value.strftime('%x').decode( + locale.getlocale()[1])) value = unicode(value) if value else default_value - #if hasattr(value, 'strftime'): - # value = value.strftime() return value def ooo_replace(infile, outfile, context, default_value=''): @@ -76,7 +89,8 @@ def ooo_replace(infile, outfile, context, default_value=''): missing_keys.add(name) for p in content.findall(".//"+OOO_NS+"conditional-text"): condition = p.get(OOO_NS+"condition") - res = 'true' if _parse_condition(condition, context) else 'false' + res = 'true' if _parse_condition(condition, context, default_value) \ + else 'false' value = p.get(OOO_NS+'string-value-if-' + res) value = _format_value(value, default_value) if value.strip() in context: diff --git a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html index 76877a716..f67eb5c1e 100644 --- a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html @@ -28,9 +28,14 @@ {{ wizard.form.as_table }} </table> {%endif%} - <p>{%if confirm_end_msg %}{{confirm_end_msg|safe}}{%else%}{% trans "Would you like to save them?" %}{%endif%}</p> <input type="hidden" name="{{ step_field }}" value="{{ step0 }}" /> {{ previous_fields|safe }} + {% if extra_form %} + <table> + {{ extra_form }} + </table> + {% endif %} + <p>{%if confirm_end_msg %}{{confirm_end_msg|safe}}{%else%}{% trans "Would you like to save them?" %}{%endif%}</p> <input type="submit" value="{% trans "Validate" %}"/> </div> </form> diff --git a/ishtar_common/templates/ishtar/wizard/wizard_done.html b/ishtar_common/templates/ishtar/wizard/wizard_done.html index a7068bbab..7de3edfce 100644 --- a/ishtar_common/templates/ishtar/wizard/wizard_done.html +++ b/ishtar_common/templates/ishtar/wizard/wizard_done.html @@ -2,5 +2,10 @@ {% load i18n %} {% block content %} <p>{%trans "Item successfully saved"%}</p> +{% if redirect %} +<script type='text/javascript' language='javascript'> +window.location.href = "{{redirect}}"; +</script> +{% endif %} </div> {% endblock %} diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 31f5f688b..c992b1a76 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -52,7 +52,7 @@ from menus import menu from ishtar_common.forms import FinalForm from ishtar_common.forms_common import PersonForm, PersonTypeForm, \ PersonFormSelection, AccountForm, FinalAccountForm, OrganizationForm, \ - AuthorForm + AuthorForm, SimplePersonForm from ishtar_common.wizards import PersonWizard, PersonModifWizard, AccountWizard import models @@ -74,7 +74,7 @@ def index(request): context_instance=RequestContext(request)) person_creation_wizard = PersonWizard.as_view([ - ('identity-person_creation', PersonForm), + ('identity-person_creation', SimplePersonForm), ('person_type-person_creation', PersonTypeForm), ('final-person_creation', FinalForm)], label=_(u"New person"), @@ -82,7 +82,7 @@ person_creation_wizard = PersonWizard.as_view([ person_modification_wizard = PersonModifWizard.as_view([ ('selec-person_modification', PersonFormSelection), - ('identity-person_modification', PersonForm), + ('identity-person_modification', SimplePersonForm), ('person_type-person_creation', PersonTypeForm), ('final-person_modification', FinalForm)], label=_(u"Person modification"), |