diff --git a/accounting/templates/accounting/operation_edit.jinja b/accounting/templates/accounting/operation_edit.jinja index d6cb0ed0..4605ad93 100644 --- a/accounting/templates/accounting/operation_edit.jinja +++ b/accounting/templates/accounting/operation_edit.jinja @@ -16,6 +16,7 @@

{% trans %}Edit operation{% endtrans %}

{% csrf_token %} + {{ form.non_field_errors() }} {{ form.journal }} {{ form.target_id }}

{{ form.amount.errors }} {{ form.amount }}

diff --git a/core/migrations/0006_auto_20161108_1703.py b/core/migrations/0006_auto_20161108_1703.py new file mode 100644 index 00000000..e9c2a04d --- /dev/null +++ b/core/migrations/0006_auto_20161108_1703.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0005_auto_20161105_1035'), + ] + + operations = [ + migrations.AddField( + model_name='sithfile', + name='is_moderated', + field=models.BooleanField(verbose_name='is moderated', default=False), + ), + ] diff --git a/core/models.py b/core/models.py index 656bf395..f797e39e 100644 --- a/core/models.py +++ b/core/models.py @@ -483,7 +483,7 @@ class Preferences(models.Model): ) def get_directory(instance, filename): - return './{0}/{1}'.format(instance.get_parent_path(), filename) + return '.{0}/{1}'.format(instance.get_parent_path(), filename) class SithFile(models.Model): name = models.CharField(_('file name'), max_length=256, blank=False) @@ -496,6 +496,7 @@ class SithFile(models.Model): mime_type = models.CharField(_('mime type'), max_length=30) size = models.IntegerField(_("size"), default=0) date = models.DateTimeField(_('date'), auto_now=True) + is_moderated = models.BooleanField(_("is moderated"), default=False) class Meta: verbose_name = _("file") @@ -503,6 +504,8 @@ class SithFile(models.Model): def is_owned_by(self, user): if hasattr(self, 'profile_of') and user.is_in_group(settings.SITH_MAIN_BOARD_GROUP): return True + if user.is_in_group(settings.SITH_GROUPS['communication-admin']['id']): + return True return user.id == self.owner.id def can_be_viewed_by(self, user): @@ -590,7 +593,7 @@ class SithFile(models.Model): return l def get_parent_path(self): - return '/'.join([p.name for p in self.get_parent_list()]) + return '/' + '/'.join([p.name for p in self.get_parent_list()]) def get_display_name(self): return self.name diff --git a/core/templates/core/file_detail.jinja b/core/templates/core/file_detail.jinja index 374999c0..8ff95a82 100644 --- a/core/templates/core/file_detail.jinja +++ b/core/templates/core/file_detail.jinja @@ -42,7 +42,8 @@ {% if not file.home_of and not file.home_of_club and file.parent %}

{% trans %}Delete{% endtrans %}

{% endif %} -{% if popup %} +{% if user.is_in_group(settings.SITH_GROUPS['communication-admin']['id']) %} +

{% trans %}Moderate{% endtrans %}

{% endif %} {% endblock %} diff --git a/core/templates/core/file_moderation.jinja b/core/templates/core/file_moderation.jinja new file mode 100644 index 00000000..ba46d806 --- /dev/null +++ b/core/templates/core/file_moderation.jinja @@ -0,0 +1,28 @@ +{% extends "core/base.jinja" %} + +{% block title %} +{% trans %}File moderation{% endtrans %} +{% endblock %} + +{% block content %} +

{% trans %}File moderation{% endtrans %}

+
+ {% for f in files %} +
+ {% if f.is_folder %} + Folder + {% else %} + File + {% endif %} +

+ {{ f.name }}
+ {% trans %}Full name: {% endtrans %}{{ f.get_parent_path()+'/'+f.name }}
+ {% trans %}Owner: {% endtrans %}{{ f.owner.get_display_name() }}
+ {% trans %}Date: {% endtrans %}{{ f.date|date(DATE_FORMAT) }} {{ f.date|time(TIME_FORMAT) }}
+

+

{% trans %}Moderate{% endtrans %} - + {% trans %}Delete{% endtrans %}

+
+ {% endfor %} +
+{% endblock %} diff --git a/core/templates/core/user_edit.jinja b/core/templates/core/user_edit.jinja index 7bee0f15..b88cab79 100644 --- a/core/templates/core/user_edit.jinja +++ b/core/templates/core/user_edit.jinja @@ -8,6 +8,7 @@

{% trans %}Edit user profile{% endtrans %}

{% csrf_token %} + {{ form.non_field_errors() }} {% for field in form %}

{{ field.errors }}


+

{% trans %}Communication{% endtrans %}

+ +{% endif %} + +

{% trans %}Club tools{% endtrans %}