Browse Source

добавил перевод ru

devel
Dmitry 9 years ago
parent
commit
4aa90f49b9
  1. 69
      accounts_app/locale/ru/LC_MESSAGES/django.po
  2. 5
      accounts_app/models.py
  3. 13
      accounts_app/templates/accounts/ext.htm
  4. 14
      accounts_app/templates/accounts/group.html
  5. 16
      accounts_app/templates/accounts/group_list.html
  6. 17
      accounts_app/templates/accounts/index.html
  7. 5
      accounts_app/templates/accounts/profile_chgroup.html
  8. 20
      accounts_app/views.py

69
accounts_app/locale/ru/LC_MESSAGES/django.po

@ -73,6 +73,9 @@ msgstr "Сохранить"
msgid "Administrators"
msgstr "Администраторы"
msgid "Administrator"
msgstr "Администратор"
msgid "Options"
msgstr "Настройки"
@ -84,3 +87,69 @@ msgstr "Изменить инфу о себе"
msgid "Permission options"
msgstr "Настройка прав"
msgid "Users must have an telephone number"
msgstr "У пользователей должен быть номер телефона"
msgid "Telephone number"
msgstr "Номер телефона"
msgid "Wrong login or password, please try again"
msgstr "Неправильный логин или пароль, попробуйте ещё раз"
msgid "Wrong password"
msgstr "Неправильный пароль"
msgid "You forget specify a password for the new account"
msgstr "Забыли указать пароль для нового аккаунта"
msgid "You forget to repeat a password for the new account"
msgstr "Забыли повторить пароль для нового аккаунта"
msgid "Subscriber with this name already exist"
msgstr "Пользователь с таким именем уже есть"
msgid "Passwords does not match, try again"
msgstr "Пароли не совпадают, попробуйте ещё раз"
msgid "The responsibility of the administrator of the group of subscribers"
msgstr "Ответственность администратора за группы абонентов"
msgid "Is enable"
msgstr "Включён-ли"
msgid "Last login"
msgstr "Последняя авторизация"
msgid "All permissions"
msgstr "Административный доступ (все права)"
msgid "Groups"
msgstr "Группы"
msgid "Group"
msgstr "Группа"
msgid "Admin groups list"
msgstr "Список групп администраторов"
msgid "Groups does not found"
msgstr "Нет групп"
msgid "Add group"
msgstr "Добавить группу"
msgid "The current distribution of rights for groups"
msgstr "Действующее распределение прав для группы"
msgid "Available rights"
msgstr "Доступные права"
msgid "Rights for the group"
msgstr "Права группы"
msgid "Edit"
msgstr "Редактировать"
msgid "Set a task"
msgstr "Дать задачу"

5
accounts_app/models.py

@ -2,6 +2,7 @@
from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, PermissionsMixin
from django.core.validators import RegexValidator
from django.utils.translation import ugettext as _
from djing.settings import DEFAULT_PICTURE
from photo_app.models import Photo
@ -14,7 +15,7 @@ class MyUserManager(BaseUserManager):
birth and password.
"""
if not telephone:
raise ValueError('Users must have an telephone number')
raise ValueError(_('Users must have an telephone number'))
user = self.model(
telephone=telephone,
@ -48,7 +49,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
is_admin = models.BooleanField(default=False)
telephone = models.CharField(
max_length=16,
verbose_name='Telephone number',
verbose_name=_('Telephone number'),
#unique=True,
validators=[RegexValidator('^\+[7,8,9,3]\d{10,11}$')]
)

13
accounts_app/templates/accounts/ext.htm

@ -1,9 +1,10 @@
{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n %}
{% block main %}
<ol class="breadcrumb">
<li><span class="glyphicon glyphicon-home"></span></li>
<li><a href="{% url 'acc_app:accounts_list' %}">Администраторы</a></li>
<li><a href="{% url 'acc_app:accounts_list' %}">{% trans 'Administrators' %}</a></li>
<li class="active">{{ userprofile.username }}</li>
</ol>
@ -22,27 +23,27 @@
<div class="caption btn-group btn-group-sm">
{% if userprofile == request.user %}
<a href="{% url 'acc_app:setup_info' %}" class="btn btn-primary btn-sm" role="button">
<span class="glyphicon glyphicon-edit"></span> Редактировать</a>
<span class="glyphicon glyphicon-edit"></span> {% trans 'Edit' %}</a>
{% endif %}
<a href="#" class="btn btn-default btn-sm disabled" role="button">
<span class="glyphicon glyphicon-star-empty"></span> Дать задачу</a>
<span class="glyphicon glyphicon-star-empty"></span> {% trans 'Set a task' %}</a>
</div>
</div>
</div>
<div class="col-sm-9">
<h3>{{ userprofile.username|default:"&lt;Нет ника&gt;" }}</h3>
<h3>{{ userprofile.username|default:_('Not assigned') }}</h3>
<ul class="nav nav-tabs">
{% url 'acc_app:other_profile' uid as profile_url %}
<li{% if profile_url == request.path %} class="active"{% endif %}>
<a href="{{ profile_url }}">
Администратор
{% trans 'Administrator' %}
</a>
</li>
{% url 'acc_app:profile_setup_group' uid as profilegroups_url %}
<li{% if profilegroups_url == request.path %} class="active"{% endif %}>
<a href="{{ profilegroups_url }}">
Группы
{% trans 'Groups' %}
</a>
</li>
</ul>

14
accounts_app/templates/accounts/group.html

@ -1,11 +1,11 @@
{% extends 'base.html' %}
{% load i18n %}
{% block main %}
<ol class="breadcrumb">
<li><span class="glyphicon glyphicon-home"></span></li>
<li><a href="{% url 'acc_app:accounts_list' %}">Администраторы</a></li>
<li><a href="{% url 'acc_app:groups_list' %}">Группы</a></li>
<li><a href="{% url 'acc_app:accounts_list' %}">{% trans 'Administrators' %}</a></li>
<li><a href="{% url 'acc_app:groups_list' %}">{% trans 'Groups' %}</a></li>
<li class="active">{{ group.name }}</li>
</ol>
@ -13,13 +13,13 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Действующее распределение прав для группы <b>{{ group.name }}</b></h3>
<h3 class="panel-title">{% trans 'The current distribution of rights for groups' %} <b>{{ group.name }}</b></h3>
</div>
<div class="panel-body">
<form role="form" action="{% url 'acc_app:group_link' group.id %}" method="post">{% csrf_token %}
<div class="choice_wrapper">
<label for="sel_left">Доступные права</label>
<label for="sel_left">{% trans 'Available rights' %}</label>
<select name="allrights" multiple id="sel_left">
{% for rgt in all_rights %}
<option value="{{ rgt.id }}">{{ rgt.content_type }} &lt;{{ rgt.name }}&gt;</option>
@ -33,7 +33,7 @@
class="black icon-arrow-left"></i></a></li>
</ul>
<div class="choice_wrapper">
<label for="sel_right">Права группы</label>
<label for="sel_right">{% trans 'Rights for the group' %}</label>
<select name="group_rights" multiple id="sel_right">
{% for rgt in grp_rights %}
<option value="{{ rgt.id }}">{{ rgt.content_type }} &lt;{{ rgt.name }}&gt;</option>
@ -41,7 +41,7 @@
</select>
</div>
<br/>
<input type="submit" value="Сохранить"> <input type="reset" value="Сбросить">
<input type="submit" value="{% trans 'Save' %}"> <input type="reset" value="{% trans 'Reset' %}">
</form>
</div>

16
accounts_app/templates/accounts/group_list.html

@ -1,14 +1,14 @@
{% extends 'base.html' %}
{% load i18n %}
{% block main %}
<ol class="breadcrumb">
<li><span class="glyphicon glyphicon-home"></span></li>
<li><a href="{% url 'acc_app:accounts_list' %}">Администраторы</a></li>
<li class="active">Группы</li>
<li><a href="{% url 'acc_app:accounts_list' %}">{% trans 'Administrators' %}</a></li>
<li class="active">{% trans 'Groups' %}</li>
</ol>
<h3>Список групп администраторов</h3>
<h3>{% trans 'Admin groups list' %}</h3>
{% include 'message_block.html' %}
@ -17,7 +17,7 @@
<thead>
<tr>
<th width="50">#</th>
<th>Группа</th>
<th>{% trans 'Group' %}</th>
<th class="col-sm-1">&mdash;</th>
</tr>
</thead>
@ -37,14 +37,16 @@
</tr>
{% empty %}
<tr>
<td colspan="3"><a href="#">Нет групп</a></td>
<td colspan="3"><a href="#">{% trans 'Groups does not found' %}</a></td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="3">
<a href="#" class="btn btn-primary btn-sm" title="Добавить группу"><i class="icon-plus"></i></a>
<a href="#" class="btn btn-primary btn-sm disabled" title="{% trans 'Add group' %}">
<span class="glyphicon glyphicon-plus"></span>
</a>
</td>
</tr>
</tfoot>

17
accounts_app/templates/accounts/index.html

@ -1,35 +1,32 @@
{% extends request.is_ajax|yesno:'nullcont.htm,accounts/ext.htm' %}
{% load i18n %}
{% block content %}
<table class="table table-striped table-bordered">
<tbody>
<tr>
<td class="col-sm-4">Телефон</td>
<td class="col-sm-4">{% trans 'Telephone' %}</td>
<td><a href="tel:{{ userprofile.telephone }}">{{ userprofile.telephone }}</a></td>
</tr>
<tr>
<td>Логин</td>
<td>{% trans 'User name' %}</td>
<td>{{ userprofile.username }}</td>
</tr>
<tr>
<td>ФИО</td>
<td>{% trans 'Name and surname' %}</td>
<td>{{ userprofile.fio }}</td>
</tr>
<tr>
<td>Включён-ли</td>
<td>{% trans 'Is enable' %}</td>
<td><input type="checkbox" {{ userprofile.is_active|yesno:' checked,' }}></td>
</tr>
<tr>
<td>Последняя авторизация</td>
<td>{% trans 'Last login' %}</td>
<td>{{ userprofile.last_login|date:"l d E Y H:i" }}</td>
</tr>
<tr>
<td>Выделенный ip</td>
<td>&lt;10.155.13.43&gt;</td>
</tr>
{% if request.user.is_superuser %}
<tr>
<td>Административный доступ (все права)</td>
<td>{% trans 'All permissions' %}</td>
<td><input type="checkbox"{{ userprofile.is_staff|yesno:' checked,' }}></td>
</tr>
{% endif %}

5
accounts_app/templates/accounts/profile_chgroup.html

@ -1,7 +1,8 @@
{% extends request.is_ajax|yesno:'nullcont.htm,accounts/ext.htm' %}
{% load i18n %}
{% block content %}
<legend>Ответственность администратора за группы абонентов</legend>
<legend>{% trans 'The responsibility of the administrator of the group of subscribers' %}</legend>
<form action="{% url 'acc_app:profile_setup_group' userprofile.id %}" method="post" role="form">{% csrf_token %}
{% for ag in abongroups %}
<div class="checkbox">
@ -16,7 +17,7 @@
</div>
{% endfor %}
<div class="btn-group">
<input type="submit" class="btn btn-primary" value="Сохранить"> <input type="reset" class="btn btn-default" value="Сбросить">
<input type="submit" class="btn btn-primary" value="{% trans 'Save' %}"> <input type="reset" class="btn btn-default" value="{% trans 'Reset' %}">
</div>
</form>

20
accounts_app/views.py

@ -7,6 +7,7 @@ from django.shortcuts import render, redirect, get_object_or_404, resolve_url
from django.http import Http404
from django.contrib.auth.models import Group, Permission
from django.contrib import messages
from django.utils.translation import ugettext as _
from abonapp.models import AbonGroup
from photo_app.models import Photo
@ -39,13 +40,13 @@ def to_signin(request):
return render(request, 'accounts/login.html', {
'next': nextl,
'errmsg': 'Неправильный логин или пароль, попробуйте ещё раз'
'errmsg': _('Wrong login or password, please try again')
})
return render(request, 'accounts/login.html', {
'next': nextl
})
except NoReverseMatch:
raise Http404("Destination page does not exist")
return redirect('acc_app:profile')
def sign_out(request):
@ -133,7 +134,7 @@ def ch_info(request):
newpasswd = request.POST.get('newpasswd')
user.set_password(newpasswd)
else:
messages.error(request, 'Неправильный пароль')
messages.error(request, _('Wrong password'))
user.save()
request.user = user
@ -158,10 +159,10 @@ def create_profile(request):
passwd = request.POST.get('passwd')
conpasswd = request.POST.get('conpasswd')
if not passwd:
messages.error(request, 'Забыли указать пароль для нового аккаунта')
messages.error(request, _('You forget specify a password for the new account'))
if not conpasswd:
messages.error(request, 'Забыли повторить пароль для нового аккаунта')
messages.error(request, _('You forget to repeat a password for the new account'))
if passwd == conpasswd:
user_qs = UserProfile.objects.filter(username=username)[:1]
@ -170,9 +171,9 @@ def create_profile(request):
user.save()
return redirect('acc_app:accounts_list')
else:
messages.error(request, 'Пользователь с таким именем уже есть')
messages.error(request, _('Subscriber with this name already exist'))
else:
messages.error(request, 'Пароли не совпадают, попробуйте ещё раз')
messages.error(request, _('Passwords does not match, try again'))
return render(request, 'accounts/create_acc.html', {
'newuser': user
})
@ -194,9 +195,7 @@ def delete_profile(request, uid):
@mydefs.only_admins
def acc_list(request):
users = UserProfile.objects.filter(is_admin=True)
users = mydefs.pag_mn(request, users)
return render(request, 'accounts/acc_list.html', {
'users': users
})
@ -207,7 +206,6 @@ def acc_list(request):
def perms(request, uid):
profile = get_object_or_404(UserProfile, id=uid)
own_permissions = UserProfile.get_all_permissions(profile)
return render(request, 'accounts/settings/permissions.html', {
'uid': uid,
'own_permissions': own_permissions
@ -218,9 +216,7 @@ def perms(request, uid):
@mydefs.only_admins
def groups(request):
grps = Group.objects.all()
grps = mydefs.pag_mn(request, grps)
return render(request, 'accounts/group_list.html', {
'groups': grps
})

Loading…
Cancel
Save