Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
da35292c
Commit
da35292c
authored
Nov 22, 2016
by
Skia
🤘
Browse files
Add is_in_sas field, to perform queries on it
parent
5481a79f
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/migrations/0010_sithfile_is_in_sas.py
0 → 100644
View file @
da35292c
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0009_auto_20161120_1155'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'sithfile'
,
name
=
'is_in_sas'
,
field
=
models
.
BooleanField
(
verbose_name
=
'is in the SAS'
,
default
=
False
),
),
]
core/models.py
View file @
da35292c
...
...
@@ -513,6 +513,7 @@ class SithFile(models.Model):
date
=
models
.
DateTimeField
(
_
(
'date'
),
auto_now
=
True
)
is_moderated
=
models
.
BooleanField
(
_
(
"is moderated"
),
default
=
False
)
asked_for_removal
=
models
.
BooleanField
(
_
(
"asked for removal"
),
default
=
False
)
is_in_sas
=
models
.
BooleanField
(
_
(
"is in the SAS"
),
default
=
False
)
class
Meta
:
verbose_name
=
_
(
"file"
)
...
...
@@ -578,6 +579,8 @@ class SithFile(models.Model):
raise
ValidationError
(
_
(
"You must provide a file"
))
def
save
(
self
,
*
args
,
**
kwargs
):
sas
=
SithFile
.
objects
.
filter
(
id
=
settings
.
SITH_SAS_ROOT_DIR_ID
).
first
()
self
.
is_in_sas
=
sas
in
self
.
get_parent_list
()
copy_rights
=
False
if
self
.
id
is
None
:
copy_rights
=
True
...
...
locale/fr/LC_MESSAGES/django.po
View file @
da35292c
...
...
@@ -6,7 +6,7 @@
msgid
""
msgstr
""
"Report-Msgid-Bugs-To:
\n
"
"POT-Creation-Date: 2016-11-2
0 23:05
+0100
\n
"
"POT-Creation-Date: 2016-11-2
2 14:58
+0100
\n
"
"PO-Revision-Date: 2016-07-18
\n
"
"Last-Translator: Skia <skia@libskia.so>
\n
"
"Language-Team: AE info <ae.info@utbm.fr>
\n
"
...
...
@@ -123,7 +123,7 @@ msgstr "numéro"
msgid
"journal"
msgstr
"classeur"
#: accounting/models.py:194 core/models.py:513 core/models.py:80
6
#: accounting/models.py:194 core/models.py:513 core/models.py:80
9
#: counter/models.py:244 counter/models.py:287 counter/models.py:405
#: eboutic/models.py:15 eboutic/models.py:48
msgid
"date"
...
...
@@ -313,7 +313,7 @@ msgstr "Compte en banque : "
#: counter/templates/counter/last_ops.jinja:59
#: launderette/templates/launderette/launderette_admin.jinja:16
#: launderette/views.py:146 sas/templates/sas/moderation.jinja:35
#: sas/templates/sas/picture.jinja:
71
#: sas/templates/sas/picture.jinja:
65
msgid
"Delete"
msgstr
"Supprimer"
...
...
@@ -592,7 +592,7 @@ msgstr "Un club avec ce nom UNIX existe déjà."
#: club/models.py:145 counter/models.py:386 counter/models.py:403
#: eboutic/models.py:14 eboutic/models.py:47 launderette/models.py:89
#: launderette/models.py:126 sas/models.py:
76
#: launderette/models.py:126 sas/models.py:
92
msgid
"user"
msgstr
"nom d'utilisateur"
...
...
@@ -617,7 +617,8 @@ msgstr "L'utilisateur est déjà membre de ce club"
msgid
"past member"
msgstr
"Anciens membres"
#: club/templates/club/club_list.jinja:4 club/templates/club/club_list.jinja:24
#: club/templates/club/club_list.jinja:4
#: club/templates/club/club_list.jinja:24
msgid
"Club list"
msgstr
"Liste des clubs"
...
...
@@ -679,8 +680,8 @@ msgstr "Du"
msgid
"To"
msgstr
"Au"
#: club/templates/club/club_sellings.jinja:5 club/views.py:59
club/views.py:216
#: counter/templates/counter/counter_main.jinja:19
#: club/templates/club/club_sellings.jinja:5 club/views.py:59
#:
club/views.py:216
counter/templates/counter/counter_main.jinja:19
#: counter/templates/counter/last_ops.jinja:35
msgid
"Sellings"
msgstr
"Ventes"
...
...
@@ -781,7 +782,7 @@ msgid "Old members"
msgstr
"Anciens membres"
#: club/views.py:49 core/templates/core/base.jinja:44 core/views/user.py:146
#: sas/templates/sas/picture.jinja:
83
#: sas/templates/sas/picture.jinja:
77
msgid
"Tools"
msgstr
"Outils"
...
...
@@ -795,7 +796,7 @@ msgstr "Propriétés"
msgid
"Select user"
msgstr
"Choisir un utilisateur"
#: club/views.py:150 sas/views.py:
83
sas/views.py:1
29
sas/views.py:1
73
#: club/views.py:150 sas/views.py:
70
sas/views.py:1
16
sas/views.py:1
58
msgid
"You do not have the permission to do that"
msgstr
"Vous n'avez pas la permission de faire cela"
...
...
@@ -1114,11 +1115,11 @@ msgstr "Montrez vos statistiques de compte aux autres"
msgid
"file name"
msgstr
"nom du fichier"
#: core/models.py:503 core/models.py:65
3
#: core/models.py:503 core/models.py:65
6
msgid
"parent"
msgstr
"parent"
#: core/models.py:504 core/models.py:51
8
#: core/models.py:504 core/models.py:51
9
msgid
"file"
msgstr
"fichier"
...
...
@@ -1134,11 +1135,11 @@ msgstr "miniature"
msgid
"owner"
msgstr
"propriétaire"
#: core/models.py:508 core/models.py:6
59
#: core/models.py:508 core/models.py:6
62
msgid
"edit group"
msgstr
"groupe d'édition"
#: core/models.py:509 core/models.py:66
0
#: core/models.py:509 core/models.py:66
3
msgid
"view group"
msgstr
"groupe de vue"
...
...
@@ -1162,69 +1163,73 @@ msgstr "est modéré"
msgid
"asked for removal"
msgstr
"retrait demandé"
#: core/models.py:552
#: core/models.py:516
msgid
"is in the SAS"
msgstr
"est dans le SAS"
#: core/models.py:553
msgid
"Character '/' not authorized in name"
msgstr
"Le caractère '/' n'est pas autorisé dans les noms de fichier"
#: core/models.py:55
5
core/models.py:56
0
#: core/models.py:55
6
core/models.py:56
1
msgid
"Loop in folder tree"
msgstr
"Boucle dans l'arborescence des dossiers"
#: core/models.py:56
4
#: core/models.py:56
5
msgid
"You can not make a file be a children of a non folder file"
msgstr
""
"Vous ne pouvez pas mettre un fichier enfant de quelque chose qui n'est pas "
"un dossier"
#: core/models.py:56
8
#: core/models.py:56
9
msgid
"Duplicate file"
msgstr
"Un fichier de ce nom existe déjà"
#: core/models.py:57
8
#: core/models.py:57
9
msgid
"You must provide a file"
msgstr
"Vous devez fournir un fichier"
#: core/models.py:6
08
#: core/models.py:6
11
msgid
"Folder: "
msgstr
"Dossier : "
#: core/models.py:61
0
#: core/models.py:61
3
msgid
"File: "
msgstr
"Fichier : "
#: core/models.py:65
2
core/models.py:65
6
#: core/models.py:65
5
core/models.py:65
9
msgid
"page name"
msgstr
"nom de la page"
#: core/models.py:6
57
#: core/models.py:6
60
msgid
"owner group"
msgstr
"groupe propriétaire"
#: core/models.py:66
1
#: core/models.py:66
4
msgid
"lock user"
msgstr
"utilisateur bloquant"
#: core/models.py:66
2
#: core/models.py:66
5
msgid
"lock_timeout"
msgstr
"décompte du déblocage"
#: core/models.py:6
8
9
#: core/models.py:69
2
msgid
"Duplicate page"
msgstr
"Une page de ce nom existe déjà"
#: core/models.py:69
5
#: core/models.py:69
8
msgid
"Loop in page tree"
msgstr
"Boucle dans l'arborescence des pages"
#: core/models.py:80
3
#: core/models.py:80
6
msgid
"revision"
msgstr
"révision"
#: core/models.py:80
4
#: core/models.py:80
7
msgid
"page title"
msgstr
"titre de la page"
#: core/models.py:80
5
#: core/models.py:80
8
msgid
"page content"
msgstr
"contenu de la page"
...
...
@@ -1275,7 +1280,7 @@ msgstr "Wiki"
#: core/templates/core/base.jinja:73 sas/templates/sas/album.jinja:4
#: sas/templates/sas/main.jinja:4 sas/templates/sas/main.jinja.py:8
#: sas/templates/sas/picture.jinja:2
5
#: sas/templates/sas/picture.jinja:2
6
msgid
"SAS"
msgstr
"SAS"
...
...
@@ -1466,11 +1471,13 @@ msgstr "login"
msgid
"Lost password?"
msgstr
"Mot de passe perdu ?"
#: core/templates/core/macros.jinja:27 core/templates/core/user_detail.jinja:27
#: core/templates/core/macros.jinja:27
#: core/templates/core/user_detail.jinja:27
msgid
"Born: "
msgstr
"Né le : "
#: core/templates/core/macros.jinja:31 core/templates/core/user_detail.jinja:48
#: core/templates/core/macros.jinja:31
#: core/templates/core/user_detail.jinja:48
msgid
"Promo: "
msgstr
"Promo : "
...
...
@@ -1970,7 +1977,7 @@ msgid "Error creating folder %(folder_name)s: %(msg)s"
msgstr
"Erreur de création du dossier %(folder_name)s : %(msg)s"
#: core/views/files.py:67 core/views/forms.py:181 core/views/forms.py:185
#: sas/views.py:5
8
#: sas/views.py:
4
5
#, python-format
msgid
"Error uploading file %(file_name)s: %(msg)s"
msgstr
"Erreur d'envoi du fichier %(file_name)s : %(msg)s"
...
...
@@ -2302,7 +2309,7 @@ msgstr "Pas de date de naissance renseigné"
#: counter/templates/counter/invoices_call.jinja:16
#: launderette/templates/launderette/launderette_admin.jinja:35
#: launderette/templates/launderette/launderette_click.jinja:13
#: sas/templates/sas/moderation.jinja:39 sas/templates/sas/picture.jinja:7
9
#: sas/templates/sas/moderation.jinja:39 sas/templates/sas/picture.jinja:7
3
msgid
"Go"
msgstr
"Valider"
...
...
@@ -2779,7 +2786,7 @@ msgstr "Utilisateur qui sera conservé"
msgid
"User that will be deleted"
msgstr
"Utilisateur qui sera supprimé"
#: sas/models.py:
77
#: sas/models.py:
93
msgid
"picture"
msgstr
"photo"
...
...
@@ -2788,7 +2795,7 @@ msgstr "photo"
msgid
"preview"
msgstr
"miniature"
#: sas/templates/sas/album.jinja:
5
9
#: sas/templates/sas/album.jinja:
4
9
msgid
"Upload"
msgstr
"Envoyer"
...
...
@@ -2804,40 +2811,40 @@ msgstr "Modération du SAS"
msgid
"Asked for removal"
msgstr
"Retrait demandé"
#: sas/templates/sas/picture.jinja:
6
5
#: sas/templates/sas/picture.jinja:5
9
msgid
"People"
msgstr
"Personne(s)"
#: sas/templates/sas/picture.jinja:
85
#: sas/templates/sas/picture.jinja:
79
msgid
"HD version"
msgstr
"Version HD"
#: sas/templates/sas/picture.jinja:8
8
#: sas/templates/sas/picture.jinja:8
2
msgid
"Rotate left"
msgstr
"Tourner vers la gauche"
#: sas/templates/sas/picture.jinja:8
9
#: sas/templates/sas/picture.jinja:8
3
msgid
"Rotate right"
msgstr
"Tourner vers la droite"
#: sas/templates/sas/picture.jinja:
90
#: sas/templates/sas/picture.jinja:
84
msgid
"Ask for removal"
msgstr
"Demander le retrait"
#: sas/views.py:2
5
#: sas/views.py:2
4
msgid
"Add a new album"
msgstr
"Ajouter un nouvel album"
#: sas/views.py:2
6
#: sas/views.py:2
5
msgid
"Upload images"
msgstr
"Envoyer les images"
#: sas/views.py:3
6
#: sas/views.py:3
5
#, python-format
msgid
"Error creating album %(album)s: %(msg)s"
msgstr
"Erreur de création de l'album %(album)s : %(msg)s"
#: sas/views.py:
6
5
#: sas/views.py:5
2
msgid
"Add user"
msgstr
"Ajouter une personne"
...
...
sas/models.py
View file @
da35292c
...
...
@@ -14,11 +14,6 @@ class Picture(SithFile):
class
Meta
:
proxy
=
True
@
property
def
is_in_sas
(
self
):
sas
=
SithFile
.
objects
.
filter
(
id
=
settings
.
SITH_SAS_ROOT_DIR_ID
).
first
()
return
sas
in
self
.
get_parent_list
()
@
property
def
is_vertical
(
self
):
im
=
Image
.
open
(
BytesIO
(
self
.
file
.
read
()))
...
...
@@ -79,11 +74,6 @@ class Album(SithFile):
class
Meta
:
proxy
=
True
@
property
def
is_in_sas
(
self
):
sas
=
SithFile
.
objects
.
filter
(
id
=
settings
.
SITH_SAS_ROOT_DIR_ID
).
first
()
return
sas
in
self
.
get_parent_list
()
def
can_be_edited_by
(
self
,
user
):
return
user
.
is_in_group
(
settings
.
SITH_SAS_ADMIN_GROUP_ID
)
...
...
sas/views.py
View file @
da35292c
...
...
@@ -33,7 +33,7 @@ class SASForm(forms.Form):
album
.
save
()
except
Exception
as
e
:
self
.
add_error
(
None
,
_
(
"Error creating album %(album)s: %(msg)s"
)
%
{
'album'
:
self
.
cleaned_data
[
'album_name'
],
'msg'
:
str
(
e
.
messag
e
)})
{
'album'
:
self
.
cleaned_data
[
'album_name'
],
'msg'
:
repr
(
e
)})
for
f
in
files
:
new_file
=
Picture
(
parent
=
parent
,
name
=
f
.
name
,
file
=
f
,
owner
=
owner
,
mime_type
=
f
.
content_type
,
size
=
f
.
_size
,
is_folder
=
False
,
is_moderated
=
automodere
)
...
...
@@ -189,7 +189,7 @@ class ModerationView(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
kwargs
=
super
(
ModerationView
,
self
).
get_context_data
(
**
kwargs
)
kwargs
[
'pictures'
]
=
[
p
for
p
in
Picture
.
objects
.
filter
(
is_moderated
=
False
).
order_by
(
'id'
)
if
p
.
is_in_sas
]
kwargs
[
'pictures'
]
=
Picture
.
objects
.
filter
(
is_moderated
=
False
,
is_in_sas
=
True
).
order_by
(
'id'
)
return
kwargs
Write
Preview
Supports
Markdown
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