Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
fa3aca90
Commit
fa3aca90
authored
Aug 30, 2018
by
Grizzly
Committed by
chirac
Aug 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Les nouveau users ne sont pas adhérents et n'ont pas de home
parent
3e679757
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
7 deletions
+40
-7
api/views.py
api/views.py
+1
-1
cotisations/models.py
cotisations/models.py
+8
-0
users/migrations/0077_auto_20180824_1750.py
users/migrations/0077_auto_20180824_1750.py
+20
-0
users/models.py
users/models.py
+4
-2
users/templates/users/profil.html
users/templates/users/profil.html
+7
-4
No files found.
api/views.py
View file @
fa3aca90
...
...
@@ -421,7 +421,7 @@ class UserViewSet(viewsets.ReadOnlyModelViewSet):
class
HomeCreationViewSet
(
viewsets
.
ReadOnlyModelViewSet
):
"""Exposes infos of `users.models.Users` objects to create homes.
"""
queryset
=
users
.
User
.
objects
.
all
(
)
queryset
=
users
.
User
.
objects
.
filter
(
state
=
0
)
serializer_class
=
serializers
.
HomeCreationSerializer
class
ClubViewSet
(
viewsets
.
ReadOnlyModelViewSet
):
...
...
cotisations/models.py
View file @
fa3aca90
...
...
@@ -243,6 +243,9 @@ def facture_post_save(**kwargs):
"""
facture
=
kwargs
[
'instance'
]
user
=
facture
.
user
if
facture
.
valid
and
facture
.
vente_set
.
filter
(
Q
(
type_cotisation
=
'All'
)
|
Q
(
type_cotisation
=
'Adhesion'
)).
exists
():
user
.
state
=
0
user
.
save
()
user
.
ldap_sync
(
base
=
False
,
access_refresh
=
True
,
mac_refresh
=
False
)
...
...
@@ -473,6 +476,11 @@ def vente_post_save(**kwargs):
purchase
.
cotisation
.
save
()
user
=
purchase
.
facture
.
user
user
.
ldap_sync
(
base
=
False
,
access_refresh
=
True
,
mac_refresh
=
False
)
if
purchase
.
facture
.
valid
and
(
purchase
.
type_cotisation
==
'All'
or
purchase
.
type_cotisation
==
'Adhesion'
):
user
=
purchase
.
facture
.
user
if
user
.
state
==
3
:
user
.
state
=
0
user
.
save
()
# TODO : change vente to purchase
...
...
users/migrations/0077_auto_20180824_1750.py
0 → 100644
View file @
fa3aca90
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-08-24 15:50
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0076_auto_20180818_1321'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'user'
,
name
=
'state'
,
field
=
models
.
IntegerField
(
choices
=
[(
0
,
'STATE_ACTIVE'
),
(
1
,
'STATE_DISABLED'
),
(
2
,
'STATE_ARCHIVE'
),
(
3
,
'STATE_NOT_YET_ACTIVE'
)],
default
=
3
),
),
]
users/models.py
View file @
fa3aca90
...
...
@@ -186,10 +186,12 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
STATE_ACTIVE
=
0
STATE_DISABLED
=
1
STATE_ARCHIVE
=
2
STATE_NOT_YET_ACTIVE
=
3
STATES
=
(
(
0
,
'STATE_ACTIVE'
),
(
1
,
'STATE_DISABLED'
),
(
2
,
'STATE_ARCHIVE'
),
(
3
,
'STATE_NOT_YET_ACTIVE'
),
)
surname
=
models
.
CharField
(
max_length
=
255
)
...
...
@@ -231,7 +233,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
blank
=
True
)
pwd_ntlm
=
models
.
CharField
(
max_length
=
255
)
state
=
models
.
IntegerField
(
choices
=
STATES
,
default
=
STATE_ACTIVE
)
state
=
models
.
IntegerField
(
choices
=
STATES
,
default
=
STATE_
NOT_YET_
ACTIVE
)
registered
=
models
.
DateTimeField
(
auto_now_add
=
True
)
telephone
=
models
.
CharField
(
max_length
=
15
,
blank
=
True
,
null
=
True
)
uid_number
=
models
.
PositiveIntegerField
(
...
...
@@ -329,7 +331,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
@
property
def
is_active
(
self
):
""" Renvoie si l'user est à l'état actif"""
return
self
.
state
==
self
.
STATE_ACTIVE
return
self
.
state
==
self
.
STATE_ACTIVE
or
self
.
state
==
self
.
STATE_NOT_YET_ACTIVE
@
property
def
is_staff
(
self
):
...
...
users/templates/users/profil.html
View file @
fa3aca90
...
...
@@ -211,11 +211,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
<th>
{% trans "State" %}
</th>
{% if users.state == 0 %}
<td><i
class=
"text-
success
"
>
{% trans "Active" %}
</i></td>
<td><i
class=
"text-
warning
"
>
{% trans "Active" %}
</i></td>
{% elif users.state == 1 %}
<td><i
class=
"text-danger"
>
{% trans "Disabled" %}
</i></td>
{% else %}
<td><i
class=
"text-warning"
>
{% trans "Archived" %}
</i></td>
<td><i
class=
"text-success"
>
{% trans "Disabled" %}
</i></td>
{% elif users.state == 2 %}
<td><i
class=
"text-danger"
>
{% trans "Archived" %}
</i></td>
{% elif users.state == 3 %}
<td><i
class=
"text-danger"
>
{% trans "Not yet Member" %}
</i></td>
{% endif %}
</tr>
<tr>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment