Dmitry 9 years ago
parent
commit
c1b7fcefef
  1. 11
      accounts_app/views.py
  2. 4
      templates/accounts/ext.htm
  3. 2
      templates/accounts/profile_chgroup.html

11
accounts_app/views.py

@ -58,10 +58,9 @@ def profile_show(request, id=0):
id = mydefs.safe_int(id)
if id == 0:
usr = request.user
else:
usr = get_object_or_404(UserProfile, id=id)
return redirect('acc_app:other_profile', id=request.user.id)
usr = get_object_or_404(UserProfile, id=id)
if request.method == 'POST':
usr.username = request.POST.get('username')
usr.fio = request.POST.get('fio')
@ -80,7 +79,11 @@ def profile_show(request, id=0):
@login_required
@mydefs.only_admins
def chgroup(request, uid):
usr = get_object_or_404(UserProfile, id=uid)
uid = mydefs.safe_int(uid)
if uid == 0:
usr = request.user
else:
usr = get_object_or_404(UserProfile, id=uid)
if request.method == 'POST':
ag = request.POST.getlist('ag')
usr.abon_groups.clear()

4
templates/accounts/ext.htm

@ -12,7 +12,9 @@
<div class="col-sm-3">
<div class="thumbnail">
{% if userprofile.avatar %}
<img alt="ava" src="{{ userprofile.avatar.min }}"/>
<a href="{{ userprofile.avatar.big }}" class="thumbnail" target="_blank">
<img alt="ava" src="{{ userprofile.avatar.min }}"/>
</a>
{% else %}
<img alt="ava" src="/static/img/user_ava.gif"/>
{% endif %}

2
templates/accounts/profile_chgroup.html

@ -1,7 +1,7 @@
{% extends request.is_ajax|yesno:'nullcont.htm,accounts/ext.htm' %}
{% block content %}
<legend>Ответственность администратора к группам абонентов</legend>
<legend>Ответственность администратора за группы абонентов</legend>
<form action="{% url 'acc_app:profile_setup_group' userprofile.id %}" method="post" role="form">{% csrf_token %}
{% for ag in abongroups %}
<div class="checkbox">

Loading…
Cancel
Save