Browse Source

Fix #151

remove-useless-fields-preferences-template
Hugo Levy-Falk 6 years ago
parent
commit
b8d8c11cb0
  1. 3
      templates/base.html
  2. 3
      users/forms.py
  3. 20
      users/migrations/0083_user_shortcuts_enabled.py
  4. 4
      users/models.py
  5. 4
      users/templates/users/profil.html

3
templates/base.html

@ -301,8 +301,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
let s = Sapphire();
Konami(s.activate);
</script>
{% if request.user.shortcuts_enabled %}
<script src="/static/js/shortcuts.js"></script>
{% endif %}
{# Read the documentation for more information #}
</body>
</html>

3
users/forms.py

@ -441,7 +441,8 @@ class AdherentEditForm(AdherentForm):
'telephone',
'room',
'shell',
'gpg_fingerprint'
'gpg_fingerprint',
'shortcuts_enabled',
]
class ClubForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):

20
users/migrations/0083_user_shortcuts_enabled.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-09-20 12:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0082_auto_20190908_1338'),
]
operations = [
migrations.AddField(
model_name='user',
name='shortcuts_enabled',
field=models.BooleanField(default=True, verbose_name='Enable shortcuts on Re2o website'),
),
]

4
users/models.py

@ -247,6 +247,10 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
blank=True,
null=True
)
shortcuts_enabled = models.BooleanField(
verbose_name=_("Enable shortcuts on Re2o website"),
default=True
)
USERNAME_FIELD = 'pseudo'
REQUIRED_FIELDS = ['surname', 'email']

4
users/templates/users/profil.html

@ -305,6 +305,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<dd>{{ users.shell }}</dd>
</div>
{% endif %}
<div class="col-md-6 col-xs-12">
<dt>{% trans "Shortcuts enabled" %}</dt>
<dd>{{ users.shortcuts_enabled | tick }}</dd>
</div>
</dl>
</div>
</div>

Loading…
Cancel
Save