diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-17 13:19:15 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:41:54 +0200 |
commit | 50fe7f87b15e323d588bc0a66b62d60ec6c92cf2 (patch) | |
tree | a980ec728dd6190c37d6defb65d2f7bee9507f36 | |
parent | deaaa804e9fe2220462ce35a5481769b7092a909 (diff) | |
download | Ishtar-50fe7f87b15e323d588bc0a66b62d60ec6c92cf2.tar.bz2 Ishtar-50fe7f87b15e323d588bc0a66b62d60ec6c92cf2.zip |
Show item at the end of person, account, organization wizard. Profile column for account tables. Profiles on person sheet.
-rw-r--r-- | ishtar_common/forms_common.py | 5 | ||||
-rw-r--r-- | ishtar_common/models.py | 10 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet_person.html | 1 | ||||
-rw-r--r-- | ishtar_common/urls.py | 2 | ||||
-rw-r--r-- | ishtar_common/views.py | 5 | ||||
-rw-r--r-- | ishtar_common/wizards.py | 11 |
6 files changed, 28 insertions, 6 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index bde5e47ed..a7c464883 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -535,8 +535,9 @@ class PersonUserFormSelection(PersonFormSelection): currents = {'pk': models.Person} pk = forms.IntegerField( label="", - widget=widgets.DataTable(reverse_lazy('get-person'), - PersonUserSelect, models.Person), + widget=widgets.DataTable(reverse_lazy('get-person-for-account'), + PersonUserSelect, models.Person, + table_cols="TABLE_COLS_ACCOUNT"), validators=[models.valid_id(models.Person)]) diff --git a/ishtar_common/models.py b/ishtar_common/models.py index d76d2e219..8d6278151 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2405,6 +2405,8 @@ class Person(Address, Merge, OwnPerms, ValueGetter): ) TABLE_COLS = ('name', 'surname', 'raw_name', 'email', 'person_types_list', 'attached_to__name', 'town') + TABLE_COLS_ACCOUNT = ('name', 'surname', 'raw_name', 'email', + 'profiles_list', 'attached_to__name', 'town') SHOW_URL = 'show-person' MODIFY_URL = 'person_modify' BASE_SEARCH_VECTORS = ['name', 'surname', 'raw_name', 'town', @@ -2418,7 +2420,7 @@ class Person(Address, Merge, OwnPerms, ValueGetter): 'attached_to': 'attached_to__pk', 'attached_to__name': 'attached_to__name', 'person_types': 'person_types__pk__in', - 'ishtaruser__isnull': 'ishtaruser__isnull' + 'ishtaruser__isnull': 'ishtaruser__isnull', } COL_LABELS = { 'attached_to__name': _(u"Organization") @@ -2525,6 +2527,12 @@ class Person(Address, Merge, OwnPerms, ValueGetter): def person_types_list(self): return u", ".join([unicode(pt) for pt in self.person_types.all()]) + profiles_list_lbl = _(u"Profiles") + + @property + def profiles_list(self): + return u", ".join([unicode(p) for p in self.profiles.all()]) + def generate_merge_key(self): if self.name and self.name.strip(): self.merge_key = slugify(self.name.strip()) + \ diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html index d6cee2e61..65c94d188 100644 --- a/ishtar_common/templates/ishtar/sheet_person.html +++ b/ishtar_common/templates/ishtar/sheet_person.html @@ -17,6 +17,7 @@ {% field_flex_detail "Created by" item.history_creator.ishtaruser.person %} {% field_flex "Email" item.email %} {% field_flex "Type(s)" item.person_types_list %} +{% field_flex "Profile(s)" item.profiles_list %} </div> {% if item.phone or item.phone2 or item.phone3 or item.mobile_phone %} diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 04d6acfb2..4a61a5fb8 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -163,6 +163,8 @@ urlpatterns += [ name='get-person'), url(r'get-person-full/(?P<type>.+)?$', views.get_person, name='get-person-full', kwargs={'full': True}), + url(r'get-person-for-account/(?P<type>.+)?$', views.get_person_for_account, + name='get-person-for-account'), url(r'show-person(?:/(?P<pk>.+))?/(?P<type>.+)?$', views.show_person, name='show-person'), url(r'department-by-state/(?P<state_id>.+)?$', views.department_by_state, diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 2023df305..352a3d6f1 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1534,6 +1534,11 @@ show_person = show_item(models.Person, 'person') get_person = get_item(models.Person, 'get_person', 'person') +get_person_for_account = get_item( + models.Person, + 'get_person', 'person', + own_table_cols=models.Person.TABLE_COLS_ACCOUNT) + get_ishtaruser = get_item(models.IshtarUser, 'get_ishtaruser', 'ishtaruser') diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 3f7502c62..cc0371982 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -42,7 +42,7 @@ from django.utils.translation import ugettext_lazy as _ from django.utils.safestring import mark_safe from ishtar_common import models -from ishtar_common.forms import CustomForm +from ishtar_common.forms import CustomForm, reverse_lazy from ishtar_common.utils import get_all_field_names, MultiValueDict logger = logging.getLogger(__name__) @@ -1375,6 +1375,7 @@ class PersonWizard(Wizard): model = models.Person wizard_templates = { 'identity-person_creation': "ishtar/wizard/wizard_person.html"} + wizard_done_window = reverse_lazy('show-person') class PersonModifWizard(PersonWizard): @@ -1397,6 +1398,7 @@ class IshtarUserDeletionWizard(DeletionWizard): class OrganizationWizard(Wizard): model = models.Organization + wizard_done_window = reverse_lazy('show-organization') class OrganizationModifWizard(OrganizationWizard): @@ -1412,8 +1414,9 @@ class OrganizationDeletionWizard(DeletionWizard): class AccountWizard(Wizard): - formset_pop_deleted = False model = models.Person + formset_pop_deleted = False + wizard_done_window = reverse_lazy('show-person') def get_formated_datas(self, forms): datas = super(AccountWizard, self).get_formated_datas(forms) @@ -1528,7 +1531,9 @@ class AccountWizard(Wizard): send_mail(subject, msg, settings.ADMINS[0][1], [dct['email']], fail_silently=True) res = render( - self.request, 'ishtar/wizard/wizard_done.html', {}, + self.request, self.wizard_done_template, + {'wizard_done_window': unicode(self.wizard_done_window), + 'item': person}, ) return res |