Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mediatek
Base de données Mediatek
Commits
2ce5e122
Verified
Commit
2ce5e122
authored
Aug 10, 2019
by
erdnaxe
🦋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Translate users models
parent
f61d09b6
Pipeline
#1413
passed with stage
in 3 minutes and 27 seconds
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
309 additions
and
20 deletions
+309
-20
users/admin.py
users/admin.py
+8
-8
users/locale/fr/LC_MESSAGES/django.po
users/locale/fr/LC_MESSAGES/django.po
+47
-3
users/migrations/0030_auto_20190810_1600.py
users/migrations/0030_auto_20190810_1600.py
+18
-0
users/migrations/0031_auto_20190810_1601.py
users/migrations/0031_auto_20190810_1601.py
+18
-0
users/migrations/0032_auto_20190810_1601.py
users/migrations/0032_auto_20190810_1601.py
+18
-0
users/migrations/0033_auto_20190810_1602.py
users/migrations/0033_auto_20190810_1602.py
+30
-0
users/migrations/0034_auto_20190810_1604.py
users/migrations/0034_auto_20190810_1604.py
+29
-0
users/migrations/0035_auto_20190810_1604.py
users/migrations/0035_auto_20190810_1604.py
+18
-0
users/migrations/0036_auto_20190810_1604.py
users/migrations/0036_auto_20190810_1604.py
+23
-0
users/migrations/0037_auto_20190810_1608.py
users/migrations/0037_auto_20190810_1608.py
+23
-0
users/migrations/0038_auto_20190810_1610.py
users/migrations/0038_auto_20190810_1610.py
+17
-0
users/migrations/0039_auto_20190810_1610.py
users/migrations/0039_auto_20190810_1610.py
+17
-0
users/models.py
users/models.py
+42
-8
users/views.py
users/views.py
+1
-1
No files found.
users/admin.py
View file @
2ce5e122
...
...
@@ -17,15 +17,15 @@ from .models import Adhesion, Clef, User
class
ClefAdmin
(
VersionAdmin
):
list_display
=
(
'n
om
'
,
'
proprio
'
,
'comment
aire
'
)
ordering
=
(
'n
om
'
,)
search_fields
=
(
'n
om
'
,
'
proprio
__username'
,
'comment
aire
'
)
autocomplete_fields
=
(
'
proprio
'
,)
list_display
=
(
'n
ame
'
,
'
owner
'
,
'comment'
)
ordering
=
(
'n
ame
'
,)
search_fields
=
(
'n
ame
'
,
'
owner
__username'
,
'comment'
)
autocomplete_fields
=
(
'
owner
'
,)
class
AdhesionAdmin
(
VersionAdmin
):
list_display
=
(
'
annee_debut'
,
'annee_f
in'
)
autocomplete_fields
=
(
'
adherent
'
,)
list_display
=
(
'
starting_in'
,
'ending_
in'
)
autocomplete_fields
=
(
'
members
'
,)
class
IsAdherentFilter
(
admin
.
SimpleListFilter
):
...
...
@@ -41,7 +41,7 @@ class IsAdherentFilter(admin.SimpleListFilter):
value
=
self
.
value
()
if
value
==
'Yes'
:
# Get current membership year and list all members
last_adh_year
=
Adhesion
.
objects
.
all
().
order_by
(
'
annee_debut
'
)
\
last_adh_year
=
Adhesion
.
objects
.
all
().
order_by
(
'
starting_in
'
)
\
.
reverse
().
first
()
return
last_adh_year
.
adherent
return
queryset
...
...
@@ -95,7 +95,7 @@ class UserAdmin(VersionAdmin, BaseUserAdmin):
"""
Get current membership year and check if user is there
"""
last_adh_year
=
Adhesion
.
objects
.
all
().
order_by
(
'
annee_debut
'
)
\
last_adh_year
=
Adhesion
.
objects
.
all
().
order_by
(
'
starting_in
'
)
\
.
reverse
().
first
()
is_member
=
last_adh_year
and
obj
in
last_adh_year
.
adherent
.
all
()
if
is_member
:
...
...
users/locale/fr/LC_MESSAGES/django.po
View file @
2ce5e122
...
...
@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-10 1
5:56
+0200\n"
"POT-Creation-Date: 2019-08-10 1
6:12
+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
@@ -19,7 +19,7 @@ msgstr "statut adhérent"
#: admin.py:37
msgid "Yes"
msgstr ""
msgstr "
Oui
"
#: admin.py:54
msgid "Personal info"
...
...
@@ -69,7 +69,7 @@ msgstr "emprunts maximal"
msgid "Maximal amount of simultaneous borrowed item authorized."
msgstr "Nombre maximal d'objets empruntés en même temps."
#: models.py:33
#: models.py:33
models.py:67
msgid "comment"
msgstr "commentaire"
...
...
@@ -81,6 +81,50 @@ msgstr ""
msgid "date joined"
msgstr ""
#: models.py:55
msgid "name"
msgstr "nom"
#: models.py:62
msgid "owner"
msgstr "propriétaire"
#: models.py:74
msgid "key"
msgstr "clé"
#: models.py:75
msgid "keys"
msgstr "clés"
#: models.py:80
msgid "starting in"
msgstr "commence en"
#: models.py:81
msgid "Year in which the membership year starts."
msgstr "Année dans laquelle la plage d'adhésion commence."
#: models.py:85
msgid "ending in"
msgstr "finie en"
#: models.py:86
msgid "Year in which the membership year ends."
msgstr "Année dans laquelle la plage d'adhésion finie."
#: models.py:91
msgid "members"
msgstr "adhérents"
#: models.py:96
msgid "membership year"
msgstr "année d'adhésion"
#: models.py:97
msgid "membership years"
msgstr "années d'adhésion"
#: templates/users/user.html:40
msgid "Change password"
msgstr ""
...
...
users/migrations/0030_auto_20190810_1600.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:00
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0029_auto_20190810_1121'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'clef'
,
old_name
=
'nom'
,
new_name
=
'name'
,
),
]
users/migrations/0031_auto_20190810_1601.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:01
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0030_auto_20190810_1600'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'clef'
,
old_name
=
'proprio'
,
new_name
=
'owner'
,
),
]
users/migrations/0032_auto_20190810_1601.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:01
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0031_auto_20190810_1601'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'clef'
,
old_name
=
'commentaire'
,
new_name
=
'comment'
,
),
]
users/migrations/0033_auto_20190810_1602.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:02
from
django.conf
import
settings
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0032_auto_20190810_1601'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'clef'
,
name
=
'comment'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
,
verbose_name
=
'comment'
),
),
migrations
.
AlterField
(
model_name
=
'clef'
,
name
=
'name'
,
field
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
,
verbose_name
=
'name'
),
),
migrations
.
AlterField
(
model_name
=
'clef'
,
name
=
'owner'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
settings
.
AUTH_USER_MODEL
,
verbose_name
=
'owner'
),
),
]
users/migrations/0034_auto_20190810_1604.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:04
from
django.conf
import
settings
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0033_auto_20190810_1602'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'adhesion'
,
name
=
'adherent'
,
field
=
models
.
ManyToManyField
(
blank
=
True
,
to
=
settings
.
AUTH_USER_MODEL
,
verbose_name
=
'members'
),
),
migrations
.
AlterField
(
model_name
=
'adhesion'
,
name
=
'annee_debut'
,
field
=
models
.
IntegerField
(
unique
=
True
,
verbose_name
=
'starting in'
),
),
migrations
.
AlterField
(
model_name
=
'adhesion'
,
name
=
'annee_fin'
,
field
=
models
.
IntegerField
(
unique
=
True
,
verbose_name
=
'ending in'
),
),
]
users/migrations/0035_auto_20190810_1604.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:04
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0034_auto_20190810_1604'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'adhesion'
,
old_name
=
'adherent'
,
new_name
=
'members'
,
),
]
users/migrations/0036_auto_20190810_1604.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:04
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0035_auto_20190810_1604'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'adhesion'
,
old_name
=
'annee_fin'
,
new_name
=
'ending_in'
,
),
migrations
.
RenameField
(
model_name
=
'adhesion'
,
old_name
=
'annee_debut'
,
new_name
=
'starting_in'
,
),
]
users/migrations/0037_auto_20190810_1608.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:08
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0036_auto_20190810_1604'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'adhesion'
,
name
=
'ending_in'
,
field
=
models
.
IntegerField
(
help_text
=
'Year in which the membership year ends.'
,
unique
=
True
,
verbose_name
=
'ending in'
),
),
migrations
.
AlterField
(
model_name
=
'adhesion'
,
name
=
'starting_in'
,
field
=
models
.
IntegerField
(
help_text
=
'Year in which the membership year starts.'
,
unique
=
True
,
verbose_name
=
'starting in'
),
),
]
users/migrations/0038_auto_20190810_1610.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:10
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0037_auto_20190810_1608'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'adhesion'
,
options
=
{
'verbose_name'
:
'membership year'
,
'verbose_name_plural'
:
'membership years'
},
),
]
users/migrations/0039_auto_20190810_1610.py
0 → 100644
View file @
2ce5e122
# Generated by Django 2.2.4 on 2019-08-10 14:10
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0038_auto_20190810_1610'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'clef'
,
options
=
{
'verbose_name'
:
'key'
,
'verbose_name_plural'
:
'keys'
},
),
]
users/models.py
View file @
2ce5e122
...
...
@@ -46,18 +46,52 @@ class User(AbstractUser):
@
property
def
is_adherent
(
self
):
last_adh_year
=
Adhesion
.
objects
.
all
().
order_by
(
'
annee_debut
'
).
reverse
().
first
()
'
starting_in
'
).
reverse
().
first
()
return
last_adh_year
and
self
in
last_adh_year
.
adherent
.
all
()
class
Clef
(
models
.
Model
):
nom
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
)
proprio
=
models
.
ForeignKey
(
'User'
,
on_delete
=
models
.
PROTECT
,
blank
=
True
,
null
=
True
)
commentaire
=
models
.
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
)
name
=
models
.
CharField
(
verbose_name
=
_
(
'name'
),
max_length
=
255
,
unique
=
True
,
)
owner
=
models
.
ForeignKey
(
'User'
,
on_delete
=
models
.
PROTECT
,
verbose_name
=
_
(
'owner'
),
blank
=
True
,
null
=
True
,
)
comment
=
models
.
CharField
(
verbose_name
=
_
(
'comment'
),
max_length
=
255
,
null
=
True
,
blank
=
True
,
)
class
Meta
:
verbose_name
=
_
(
'key'
)
verbose_name_plural
=
_
(
'keys'
)
class
Adhesion
(
models
.
Model
):
annee_debut
=
models
.
IntegerField
(
unique
=
True
)
annee_fin
=
models
.
IntegerField
(
unique
=
True
)
adherent
=
models
.
ManyToManyField
(
'User'
,
blank
=
True
)
starting_in
=
models
.
IntegerField
(
verbose_name
=
_
(
'starting in'
),
help_text
=
_
(
'Year in which the membership year starts.'
),
unique
=
True
,
)
ending_in
=
models
.
IntegerField
(
verbose_name
=
_
(
'ending in'
),
help_text
=
_
(
'Year in which the membership year ends.'
),
unique
=
True
,
)
members
=
models
.
ManyToManyField
(
'User'
,
verbose_name
=
_
(
'members'
),
blank
=
True
,
)
class
Meta
:
verbose_name
=
_
(
'membership year'
)
verbose_name_plural
=
_
(
'membership years'
)
users/views.py
View file @
2ce5e122
...
...
@@ -49,7 +49,7 @@ def adherer(request, userid):
except
User
.
DoesNotExist
:
messages
.
error
(
request
,
"Utilisateur inexistant"
)
return
redirect
(
"admin:users_user_changelist"
)
adh_year
=
Adhesion
.
objects
.
all
().
order_by
(
'
annee_debut
'
).
reverse
().
first
()
adh_year
=
Adhesion
.
objects
.
all
().
order_by
(
'
starting_in
'
).
reverse
().
first
()
if
not
adh_year
:
messages
.
error
(
request
,
"Année d'adhésion non définie"
)
return
redirect
(
"admin:users_user_changelist"
)
...
...
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