summaryrefslogtreecommitdiff
path: root/ishtar_common/views.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-04 18:54:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:24 +0100
commit27c6ee68fb90f47bf7a5a94c6f0eefa09b6e53b9 (patch)
tree43fc3285486bace07d3ce0588c8960328664c52a /ishtar_common/views.py
parentb465079492db9d1b5072468e093f7843abb0c5ca (diff)
downloadIshtar-27c6ee68fb90f47bf7a5a94c6f0eefa09b6e53b9.tar.bz2
Ishtar-27c6ee68fb90f47bf7a5a94c6f0eefa09b6e53b9.zip
Typo fix
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r--ishtar_common/views.py160
1 files changed, 80 insertions, 80 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index d5b38ebed..874252962 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -96,7 +96,7 @@ def wizard_is_available(wizard, request, model, pk):
except IndexError: # no step available
put_session_message(
request.session.session_key,
- _(u"You don't have sufficient permissions to do this action."),
+ _("You don't have sufficient permissions to do this action."),
'warning'
)
return
@@ -122,8 +122,8 @@ def index(request):
dct = {'warnings': []}
if settings.PROJECT_SLUG == 'default':
dct['warnings'].append(_(
- u"PROJECT_SLUG is set to \"default\". Change it in your "
- u"local_settings (or ask your admin to do it)."))
+ "PROJECT_SLUG is set to \"default\". Change it in your "
+ "local_settings (or ask your admin to do it)."))
profile = get_current_profile()
if profile.slug == 'default':
dct['warnings'].append(_(
@@ -146,14 +146,14 @@ def index(request):
person_search_wizard = wizards.PersonSearch.as_view(
[('general-person_search', forms.PersonFormSelection)],
- label=_(u"Person search"),
+ label=_("Person search"),
url_name='person_search',)
person_creation_wizard = wizards.PersonWizard.as_view(
[('identity-person_creation', forms.SimplePersonForm),
('person_type-person_creation', forms.PersonTypeForm),
('final-person_creation', FinalForm)],
- label=_(u"New person"),
+ label=_("New person"),
url_name='person_creation')
person_modification_wizard = wizards.PersonModifWizard.as_view(
@@ -161,7 +161,7 @@ person_modification_wizard = wizards.PersonModifWizard.as_view(
('identity-person_modification', forms.SimplePersonForm),
('person_type-person_creation', forms.PersonTypeForm),
('final-person_modification', FinalForm)],
- label=_(u"Person modification"),
+ label=_("Person modification"),
url_name='person_modification')
@@ -178,7 +178,7 @@ def person_modify(request, pk):
person_deletion_wizard = wizards.PersonDeletionWizard.as_view(
[('selec-person_deletion', forms.PersonFormMultiSelection),
('final-person_deletion', FinalDeleteForm)],
- label=_(u"Person deletion"),
+ label=_("Person deletion"),
url_name='person_deletion',)
@@ -193,20 +193,20 @@ def person_delete(request, pk):
organization_search_wizard = wizards.OrganizationSearch.as_view(
[('general-organization_search', forms.OrganizationFormSelection)],
- label=_(u"Organization search"),
+ label=_("Organization search"),
url_name='organization_search',)
organization_creation_wizard = wizards.OrganizationWizard.as_view(
[('identity-organization_creation', forms.OrganizationForm),
('final-organization_creation', FinalForm)],
- label=_(u"New organization"),
+ label=_("New organization"),
url_name='organization_creation')
organization_modification_wizard = wizards.OrganizationModifWizard.as_view(
[('selec-organization_modification', forms.OrganizationFormSelection),
('identity-organization_modification', forms.OrganizationForm),
('final-organization_modification', FinalForm)],
- label=_(u"Organization modification"),
+ label=_("Organization modification"),
url_name='organization_modification')
@@ -224,7 +224,7 @@ def organization_modify(request, pk):
organization_deletion_wizard = wizards.OrganizationDeletionWizard.as_view(
[('selec-organization_deletion', forms.OrganizationFormMultiSelection),
('final-organization_deletion', FinalDeleteForm)],
- label=_(u"Organization deletion"),
+ label=_("Organization deletion"),
url_name='organization_deletion',)
@@ -247,13 +247,13 @@ account_wizard_steps = [
account_management_wizard = wizards.AccountWizard.as_view(
account_wizard_steps,
- label=_(u"Account management"),
+ label=_("Account management"),
url_name='account_management',)
account_deletion_wizard = wizards.IshtarUserDeletionWizard.as_view(
[('selec-account_deletion', forms.AccountFormSelection),
('final-account_deletion', FinalDeleteForm)],
- label=_(u"Account deletion"),
+ label=_("Account deletion"),
url_name='account_deletion',)
@@ -320,19 +320,19 @@ def shortcut_menu(request):
profile = get_current_profile()
CURRENT_ITEMS = []
if profile.files:
- CURRENT_ITEMS.append((_(u"Archaeological file"), File))
- CURRENT_ITEMS.append((_(u"Operation"), Operation))
+ CURRENT_ITEMS.append((_("Archaeological file"), File))
+ CURRENT_ITEMS.append((_("Operation"), Operation))
if profile.archaeological_site:
CURRENT_ITEMS.append((profile.get_site_label(), ArchaeologicalSite))
if profile.context_record:
- CURRENT_ITEMS.append((_(u"Context record"), ContextRecord))
+ CURRENT_ITEMS.append((_("Context record"), ContextRecord))
if profile.warehouse:
- CURRENT_ITEMS.append((_(u"Warehouse"), Warehouse))
+ CURRENT_ITEMS.append((_("Warehouse"), Warehouse))
if profile.find:
- CURRENT_ITEMS.append((_(u"Find"), Find))
+ CURRENT_ITEMS.append((_("Find"), Find))
if profile.warehouse:
- CURRENT_ITEMS.append((_(u"Treatment request"), TreatmentFile))
- CURRENT_ITEMS.append((_(u"Treatment"), Treatment))
+ CURRENT_ITEMS.append((_("Treatment request"), TreatmentFile))
+ CURRENT_ITEMS.append((_("Treatment"), Treatment))
if hasattr(request.user, 'ishtaruser') and \
request.user.ishtaruser.advanced_shortcut_menu:
dct = {
@@ -848,7 +848,7 @@ def action(request, action_slug, obj_id=None, *args, **kwargs):
Action management
"""
if not check_permission(request, action_slug, obj_id):
- not_permitted_msg = ugettext(u"Operation not permitted.")
+ not_permitted_msg = ugettext("Operation not permitted.")
return HttpResponse(not_permitted_msg)
request.session['CURRENT_ACTION'] = action_slug
dct = {}
@@ -865,15 +865,15 @@ def dashboard_main(request, dct, obj_id=None, *args, **kwargs):
app_list = []
profile = models.get_current_profile()
if profile.files:
- app_list.append((_(u"Archaeological files"), 'files'))
- app_list.append((_(u"Operations"), 'operations'))
+ app_list.append((_("Archaeological files"), 'files'))
+ app_list.append((_("Operations"), 'operations'))
if profile.context_record:
- app_list.append((_(u"Context records"), 'contextrecords'))
+ app_list.append((_("Context records"), 'contextrecords'))
if profile.find:
- app_list.append((_(u"Finds"), 'finds'))
+ app_list.append((_("Finds"), 'finds'))
if profile.warehouse:
- app_list.append((_(u"Treatment requests"), 'treatmentfiles'))
- app_list.append((_(u"Treatments"), 'treatments'))
+ app_list.append((_("Treatment requests"), 'treatmentfiles'))
+ app_list.append((_("Treatments"), 'treatments'))
dct = {'app_list': app_list}
return render(request, 'ishtar/dashboards/dashboard_main.html', dct)
@@ -923,29 +923,29 @@ def dashboard_main_detail(request, item_name):
if date_source:
dashboard_kwargs['date_source'] = date_source
if item_name == 'files' and profile.files:
- lbl, dashboard = (_(u"Archaeological files"),
+ lbl, dashboard = (_("Archaeological files"),
models.Dashboard(File, **dashboard_kwargs))
elif item_name == 'operations':
from archaeological_operations.models import Operation
- lbl, dashboard = (_(u"Operations"),
+ lbl, dashboard = (_("Operations"),
models.Dashboard(Operation, **dashboard_kwargs))
elif item_name == 'contextrecords' and profile.context_record:
lbl, dashboard = (
- _(u"Context records"),
+ _("Context records"),
models.Dashboard(ContextRecord, slice=slicing, fltr=fltr))
elif item_name == 'finds' and profile.find:
- lbl, dashboard = (_(u"Finds"), models.Dashboard(Find,
+ lbl, dashboard = (_("Finds"), models.Dashboard(Find,
slice=slicing,
fltr=fltr))
elif item_name == 'treatmentfiles' and profile.warehouse:
lbl, dashboard = (
- _(u"Treatment requests"),
+ _("Treatment requests"),
models.Dashboard(TreatmentFile, **dashboard_kwargs))
elif item_name == 'treatments' and profile.warehouse:
if 'date_source' not in dashboard_kwargs:
dashboard_kwargs['date_source'] = 'start'
lbl, dashboard = (
- _(u"Treatments"),
+ _("Treatments"),
models.Dashboard(Treatment, **dashboard_kwargs))
if not lbl:
raise Http404
@@ -1116,7 +1116,7 @@ class ProfileEdit(LoginRequiredMixin, FormView):
def get_context_data(self, **kwargs):
data = super(ProfileEdit, self).get_context_data(**kwargs)
- data['page_name'] = _(u"Current profile")
+ data['page_name'] = _("Current profile")
return data
def form_valid(self, form):
@@ -1234,7 +1234,7 @@ class GlobalVarEdit(IshtarMixin, AdminLoginRequiredMixin, ModelFormSetView):
'extra': 1,
'can_delete': True
}
- page_name = _(u"Global variables")
+ page_name = _("Global variables")
fields = ['slug', 'value', 'description']
@@ -1242,7 +1242,7 @@ class NewImportView(IshtarMixin, LoginRequiredMixin, CreateView):
template_name = 'ishtar/form.html'
model = models.Import
form_class = forms.NewImportForm
- page_name = _(u"New import")
+ page_name = _("New import")
def get_success_url(self):
return reverse('current_imports')
@@ -1261,7 +1261,7 @@ class NewImportView(IshtarMixin, LoginRequiredMixin, CreateView):
class ImportListView(IshtarMixin, LoginRequiredMixin, ListView):
template_name = 'ishtar/import_list.html'
model = models.Import
- page_name = _(u"Current imports")
+ page_name = _("Current imports")
current_url = 'current_imports'
def get_queryset(self):
@@ -1325,7 +1325,7 @@ class ImportListView(IshtarMixin, LoginRequiredMixin, ListView):
class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
template_name = 'ishtar/import_step_by_step.html'
- page_name = _(u"Import step by step")
+ page_name = _("Import step by step")
current_url = 'import_step_by_step'
def get_import(self):
@@ -1420,7 +1420,7 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
if not data or not data[0]:
self.errors = self.imprt.errors
if not self.errors:
- self.errors = [("", "", _(u"No data provided"))]
+ self.errors = [("", "", _("No data provided"))]
else:
self.new_data = data[:]
return super(ImportStepByStepView, self).get(request, *args, **kwargs)
@@ -1474,18 +1474,18 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
if previous:
dct['page_numbers'].insert(0,
- (_(u"Previous"), previous + 1, True, False,
+ (_("Previous"), previous + 1, True, False,
True)
)
else:
dct['page_numbers'].insert(0,
- (_(u"Previous"), self.imprt_obj.skip_lines, False, False, True)
+ (_("Previous"), self.imprt_obj.skip_lines, False, False, True)
)
if has_next:
- dct['page_numbers'].append((_(u"Next"), has_next + 1, True, False,
+ dct['page_numbers'].append((_("Next"), has_next + 1, True, False,
True))
else:
- dct['page_numbers'].append((_(u"Next"), total_line_nb, False,
+ dct['page_numbers'].append((_("Next"), total_line_nb, False,
False, True))
def get_context_data(self, **kwargs):
@@ -1498,7 +1498,7 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
dct['errors'] = self.errors
if self.errors:
if self.imprt.current_csv_line:
- headers = [f.label if f else _(u"Not imported")
+ headers = [f.label if f else _("Not imported")
for f in self.imprt.get_formaters()]
dct['values'] = zip(
range(1, len(headers) + 1), headers,
@@ -1508,16 +1508,16 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
headers, self.path_to_column, interpreted_values = [], {}, []
for idx, formater in enumerate(self.imprt.get_formaters()):
if not formater:
- headers.append(_(u"Not imported"))
- interpreted_values.append(u"&ndash;")
+ headers.append(_("Not imported"))
+ interpreted_values.append("&ndash;")
continue
lbl = formater.label
if formater.comment:
- lbl += u' <i data-toggle="tooltip" class="fa '
- lbl += u'fa-question-circle"'
- lbl += u' aria-hidden="true" title="{}">'.format(
- formater.comment.replace(u'"', u'&quot;'))
- lbl += u'</i>'
+ lbl += ' <i data-toggle="tooltip" class="fa '
+ lbl += 'fa-question-circle"'
+ lbl += ' aria-hidden="true" title="{}">'.format(
+ formater.comment.replace('"', '&quot;'))
+ lbl += '</i>'
headers.append(lbl)
field_name = ""
@@ -1527,10 +1527,10 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
field_name = formater.export_field_name[0]
value = self.new_data[0].copy()
- field_name_tuple = field_name.split(u'__')
+ field_name_tuple = field_name.split('__')
# associate each path level to this column
while field_name_tuple:
- current_field_name = u'__'.join(field_name_tuple)
+ current_field_name = '__'.join(field_name_tuple)
if current_field_name not in self.path_to_column:
self.path_to_column[current_field_name] = []
self.path_to_column[current_field_name].append(idx)
@@ -1585,7 +1585,7 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
new_objects[key] = ([label], cls, value_dct)
dct['new_objects'] = [
- [u" &ndash; ".join(lbls), cls, new_dct]
+ [" &ndash; ".join(lbls), cls, new_dct]
for lbls, cls, new_dct in new_objects.values()
]
@@ -1647,7 +1647,7 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
return dct
def transform_path_to_label(self, cls, path):
- label = u" > ".join(
+ label = " > ".join(
str(l)
for l in get_field_labels_from_path(cls, path)
)
@@ -1664,31 +1664,31 @@ class ImportStepByStepView(IshtarMixin, LoginRequiredMixin, TemplateView):
else:
label = k
- concat_path = u"__".join(list(path) + [k])
+ concat_path = "__".join(list(path) + [k])
if concat_path in self.path_to_column:
for col in self.path_to_column[concat_path]:
col += 1
- label += u" <a href=\"#col-{}\">"\
- u"<span class=\"badge badge-info\"> {} {} </span>"\
- u"</a>".format(col, _(u"Col. "), col)
+ label += " <a href=\"#col-{}\">"\
+ "<span class=\"badge badge-info\"> {} {} </span>"\
+ "</a>".format(col, _("Col. "), col)
value_dct[label] = dct[k]
return value_dct
def list_to_html(self, lst):
if not lst:
- return _(u"* empty *")
- return u"<ul class='list-group'><li class='list-group-item'>" + \
- u"</li><li class='list-group-item'>".join([
+ return _("* empty *")
+ return "<ul class='list-group'><li class='list-group-item'>" + \
+ "</li><li class='list-group-item'>".join([
self.get_value(item) for item in lst
- ]) + u"</li></ul>"
+ ]) + "</li></ul>"
def get_value(self, item):
if hasattr(item, 'SHOW_URL'):
- return u"{}{}".format(str(item), simple_link_to_window(item))
+ return "{}{}".format(str(item), simple_link_to_window(item))
if hasattr(item, 'explicit_label'):
return item.explicit_label
if item in (None, [], [None]):
- return _(u"* empty *")
+ return _("* empty *")
if isinstance(item, list):
return self.list_to_html(item)
return str(item)
@@ -1715,7 +1715,7 @@ class ImportListTableView(ImportListView):
class ImportOldListView(ImportListView):
- page_name = _(u"Old imports")
+ page_name = _("Old imports")
current_url = 'old_imports'
def get_queryset(self):
@@ -1764,7 +1764,7 @@ class ImportLinkView(IshtarMixin, LoginRequiredMixin, ModelFormSetView):
class ImportDeleteView(IshtarMixin, LoginRequiredMixin, DeleteView):
template_name = 'ishtar/import_delete.html'
model = models.Import
- page_name = _(u"Delete import")
+ page_name = _("Delete import")
def get_success_url(self):
return reverse('current_imports')
@@ -1796,14 +1796,14 @@ class ManualMergeMixin(object):
def get_success_url(self):
return reverse(
self.redir_url,
- args=[u"_".join([str(item.pk) for item in self.items])])
+ args=["_".join([str(item.pk) for item in self.items])])
class PersonManualMerge(ManualMergeMixin, IshtarMixin, LoginRequiredMixin,
FormView):
form_class = forms.PersonMergeFormSelection
template_name = 'ishtar/form.html'
- page_name = _(u"Merge persons")
+ page_name = _("Merge persons")
current_url = 'person-manual-merge'
redir_url = 'person_manual_merge_items'
@@ -1827,7 +1827,7 @@ class PersonManualMergeItems(
LoginRequiredMixin, FormView):
form_class = forms.PersonMergeIntoForm
template_name = 'ishtar/form.html'
- page_name = _(u"Select the main person")
+ page_name = _("Select the main person")
current_url = 'person-manual-merge-items'
item_type = 'person'
@@ -1836,7 +1836,7 @@ class OrgaManualMerge(ManualMergeMixin, IshtarMixin, LoginRequiredMixin,
FormView):
form_class = forms.OrgaMergeFormSelection
template_name = 'ishtar/form.html'
- page_name = _(u"Merge organization")
+ page_name = _("Merge organization")
current_url = 'orga-manual-merge'
redir_url = 'orga_manual_merge_items'
@@ -1846,7 +1846,7 @@ class OrgaManualMergeItems(
LoginRequiredMixin, FormView):
form_class = forms.OrgaMergeIntoForm
template_name = 'ishtar/form.html'
- page_name = _(u"Select the main organization")
+ page_name = _("Select the main organization")
current_url = 'orga-manual-merge-items'
item_type = 'organization'
@@ -2045,7 +2045,7 @@ document_deletion_steps = [
document_deletion_wizard = wizards.DocumentDeletionWizard.as_view(
document_deletion_steps,
- label=_(u"Document deletion"),
+ label=_("Document deletion"),
url_name='document_deletion',)
@@ -2187,7 +2187,7 @@ class QRCodeForSearchView(LoginRequiredMixin, FormView):
class SearchQueryDelete(LoginRequiredMixin, DeleteView):
model = models.SearchQuery
template_name = 'ishtar/forms/bookmark_delete.html'
- page_name = _(u"Delete bookmark")
+ page_name = _("Delete bookmark")
def dispatch(self, request, *args, **kwargs):
if not request.user.pk:
@@ -2210,8 +2210,8 @@ class SearchQueryDelete(LoginRequiredMixin, DeleteView):
def get_context_data(self, **kwargs):
data = super(SearchQueryDelete, self).get_context_data(**kwargs)
data['modal_size'] = "small"
- data['page_name'] = _(u"Bookmark - Delete")
- data['action_name'] = _(u"Delete")
+ data['page_name'] = _("Bookmark - Delete")
+ data['action_name'] = _("Delete")
data['item'] = self.search_query.label
data['url'] = reverse('bookmark-delete', args=[self.search_query.pk])
return data
@@ -2326,7 +2326,7 @@ class QAItemForm(IshtarMixin, LoginRequiredMixin, FormView):
data['url'] = self.url
data['items'] = self.items
data['modal_size'] = self.modal_size
- data['page_name'] = u"{} &ndash; {}".format(
+ data['page_name'] = "{} &ndash; {}".format(
self.model._meta.verbose_name, self.page_name)
return data
@@ -2363,13 +2363,13 @@ class QAItemEditForm(QAItemForm):
def get_context_data(self, **kwargs):
data = super(QAItemEditForm, self).get_context_data(**kwargs)
- data['page_name'] = u"{} &ndash; {}".format(
+ data['page_name'] = "{} &ndash; {}".format(
self.model._meta.verbose_name, self.model.QA_EDIT.text)
if self.confirm:
if 'confirm' not in self.url:
data['url'] = self.url.split('?')[0] + "confirm/"
data['confirm'] = True
- data['action_name'] = _(u"Confirm")
+ data['action_name'] = _("Confirm")
return data
def form_valid(self, form):
@@ -2444,7 +2444,7 @@ class QADocumentPackagingFormView(QAItemForm):
template_name = 'ishtar/forms/qa_document_packaging.html'
model = models.Document
form_class = forms.QADocumentPackagingForm
- page_name = _(u"Packaging")
+ page_name = _("Packaging")
base_url = "document-qa-packaging"
def dispatch(self, request, *args, **kwargs):