mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 19:33:11 +00:00
i18n pour l'historique
This commit is contained in:
parent
6b945bf322
commit
fa6614adb5
1 changed files with 8 additions and 10 deletions
|
@ -44,8 +44,9 @@ from django.shortcuts import render, redirect
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.db.models import Count, Max, F
|
from django.db.models import Count
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from reversion.models import Revision
|
from reversion.models import Revision
|
||||||
from reversion.models import Version, ContentType
|
from reversion.models import Version, ContentType
|
||||||
|
@ -482,20 +483,20 @@ def history(request, application, object_name, object_id):
|
||||||
try:
|
try:
|
||||||
model = apps.get_model(application, object_name)
|
model = apps.get_model(application, object_name)
|
||||||
except LookupError:
|
except LookupError:
|
||||||
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
|
raise Http404(_("No model found."))
|
||||||
object_name_id = object_name + 'id'
|
object_name_id = object_name + 'id'
|
||||||
kwargs = {object_name_id: object_id}
|
kwargs = {object_name_id: object_id}
|
||||||
try:
|
try:
|
||||||
instance = model.get_instance(**kwargs)
|
instance = model.get_instance(**kwargs)
|
||||||
except model.DoesNotExist:
|
except model.DoesNotExist:
|
||||||
messages.error(request, u"Entrée inexistante")
|
messages.error(request, _("No entry found."))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(request.user.id)}
|
kwargs={'userid': str(request.user.id)}
|
||||||
))
|
))
|
||||||
can, msg = instance.can_view(request.user)
|
can, msg = instance.can_view(request.user)
|
||||||
if not can:
|
if not can:
|
||||||
messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu")
|
messages.error(request, msg or _("You cannot acces to this menu"))
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
kwargs={'userid': str(request.user.id)}
|
kwargs={'userid': str(request.user.id)}
|
||||||
|
@ -512,6 +513,3 @@ def history(request, application, object_name, object_id):
|
||||||
're2o/history.html',
|
're2o/history.html',
|
||||||
{'reversions': reversions, 'object': instance}
|
{'reversions': reversions, 'object': instance}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue