Commit 6bf29f0c authored by klafyvel's avatar klafyvel
Browse files

Merge branch 'fix_194' into 'dev'

Fix 194

See merge request federez/re2o!387
parents 4f2c1dcb 0b1c3590
Pipeline #932 canceled with stage
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2019-01-05 17:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0056_4_radiusoption'),
operations = [
field=models.BooleanField(default=False, help_text='If True, all new created and connected users are active. If False, only when a valid registration has been paid'),
......@@ -116,6 +116,11 @@ class OptionalUser(AclMixin, PreferencesModel):
help_text=_("A new user can create their account on Re2o")
all_users_active = models.BooleanField(
help_text=_("If True, all new created and connected users are active.\
If False, only when a valid registration has been paid")
class Meta:
permissions = (
......@@ -122,6 +122,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% trans "Delete not yet active users after" %}</th>
<td>{{ useroptions.delete_notyetactive }} days</td>
<th>{% trans "All users are active by default" %}</th>
<td>{{ useroptions.all_users_active|tick }}</td>
<h4 id="users">{% trans "Users general permissions" %}</h4>
......@@ -117,6 +117,7 @@ class PassForm(FormRevMixin, FieldPermissionFormMixin, forms.ModelForm):
"""Changement du mot de passe"""
user = super(PassForm, self).save(commit=False)
......@@ -387,6 +388,20 @@ class AdherentCreationForm(AdherentForm):
#gtu_check.label = mark_safe("{} <a href='/media/{}' download='CGU'>{}</a>{}".format(
# _("I commit to accept the"), GeneralOption.get_cached_value('GTU'), _("General Terms of Use"), _(".")))
class Meta:
model = Adherent
fields = [
def __init__(self, *args, **kwargs):
super(AdherentCreationForm, self).__init__(*args, **kwargs)
......@@ -337,7 +337,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
def set_active(self):
"""Enable this user if he subscribed successfully one time before"""
if self.state == self.STATE_NOT_YET_ACTIVE:
if self.facture_set.filter(valid=True).filter(Q(vente__type_cotisation='All') | Q(vente__type_cotisation='Adhesion')).exists():
if self.facture_set.filter(valid=True).filter(Q(vente__type_cotisation='All') | Q(vente__type_cotisation='Adhesion')).exists() or OptionalUser.get_cached_value('all_users_active'):
self.state = self.STATE_ACTIVE
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment