Merge branch 'development' into feature/multi-tenant
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__title__ = 'Mayan EDMS'
|
||||
__version__ = '2.1rc1'
|
||||
__version__ = '2.1rc2'
|
||||
__build__ = 0x020100
|
||||
__author__ = 'Roberto Rosario'
|
||||
__author_email__ = 'roberto.rosario@mayan-edms.com'
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
from django.db import connection, migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('documents', '0031_convert_uuid'),
|
||||
]
|
||||
@@ -18,3 +18,13 @@ class Migration(migrations.Migration):
|
||||
field=models.UUIDField(default=uuid.uuid4, editable=False),
|
||||
),
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Migration, self).__init__(*args, **kwargs)
|
||||
|
||||
if connection.vendor == 'postgresql':
|
||||
self.operations.insert(
|
||||
0, migrations.RunSQL(
|
||||
'ALTER TABLE documents_document ALTER COLUMN uuid SET DATA TYPE UUID USING uuid::uuid;'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ from .tasks import task_execute_statistic # NOQA - Force registration of task
|
||||
|
||||
class StatisticsApp(MayanAppConfig):
|
||||
name = 'statistics'
|
||||
test = True
|
||||
verbose_name = _('Statistics')
|
||||
|
||||
def ready(self):
|
||||
@@ -60,7 +61,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
)
|
||||
|
||||
menu_object.bind_links(links=(link_execute, link_view), sources=(Statistic,))
|
||||
menu_object.bind_links(
|
||||
links=(link_execute, link_view), sources=(Statistic,)
|
||||
)
|
||||
menu_object.bind_links(
|
||||
links=(link_namespace_details,), sources=(StatisticNamespace,)
|
||||
)
|
||||
|
||||
@@ -116,7 +116,9 @@ class Statistic(object):
|
||||
|
||||
StatisticResult.objects.filter(slug=self.slug).delete()
|
||||
|
||||
statistic_result, created = StatisticResult.objects.get_or_create(slug=self.slug)
|
||||
statistic_result, created = StatisticResult.objects.get_or_create(
|
||||
slug=self.slug
|
||||
)
|
||||
statistic_result.store_data(data=results)
|
||||
|
||||
def get_results(self):
|
||||
|
||||
0
mayan/apps/statistics/tests/__init__.py
Normal file
0
mayan/apps/statistics/tests/__init__.py
Normal file
36
mayan/apps/statistics/tests/test_views.py
Normal file
36
mayan/apps/statistics/tests/test_views.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from common.tests.test_views import GenericViewTestCase
|
||||
|
||||
from user_management.tests.literals import (
|
||||
TEST_USER_PASSWORD, TEST_USER_USERNAME
|
||||
)
|
||||
|
||||
from ..classes import Statistic
|
||||
from ..permissions import permission_statistics_view
|
||||
|
||||
|
||||
class StatisticsViewTestCase(GenericViewTestCase):
|
||||
def test_statistic_detail_view_no_permissions(self):
|
||||
self.login(username=TEST_USER_USERNAME, password=TEST_USER_PASSWORD)
|
||||
|
||||
statistic = Statistic.get_all()[0]
|
||||
|
||||
response = self.get(
|
||||
'statistics:statistic_detail', args=(statistic.slug,)
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_statistic_detail_view_with_permissions(self):
|
||||
self.login(username=TEST_USER_USERNAME, password=TEST_USER_PASSWORD)
|
||||
|
||||
self.role.permissions.add(permission_statistics_view.stored_permission)
|
||||
|
||||
statistic = Statistic.get_all()[0]
|
||||
|
||||
response = self.get(
|
||||
'statistics:statistic_detail', args=(statistic.slug,)
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -4,9 +4,7 @@ from django.core.urlresolvers import reverse
|
||||
from django.http import Http404
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.generics import (
|
||||
ConfirmView, SingleObjectDetailView, SingleObjectListView
|
||||
)
|
||||
from common.generics import ConfirmView, SimpleView, SingleObjectListView
|
||||
|
||||
from .classes import Statistic, StatisticNamespace
|
||||
from .permissions import permission_statistics_view
|
||||
@@ -42,7 +40,7 @@ class NamespaceDetailView(SingleObjectListView):
|
||||
return self.get_namespace().statistics
|
||||
|
||||
|
||||
class StatisticDetailView(SingleObjectDetailView):
|
||||
class StatisticDetailView(SimpleView):
|
||||
view_permission = permission_statistics_view
|
||||
|
||||
def get_extra_context(self):
|
||||
@@ -75,7 +73,9 @@ class StatisticQueueView(ConfirmView):
|
||||
# Translators: This text is asking users if they want to queue
|
||||
# (to send to the queue) a statistic for it to be update ahead
|
||||
# of schedule
|
||||
'title': _('Queue statistic "%s" to be updated?') % self.get_object(),
|
||||
'title': _(
|
||||
'Queue statistic "%s" to be updated?'
|
||||
) % self.get_object(),
|
||||
}
|
||||
|
||||
def get_object(self):
|
||||
|
||||
@@ -5,7 +5,7 @@ celery==3.1.19
|
||||
cssmin==0.2.0
|
||||
|
||||
django-activity-stream==0.6.0
|
||||
django-autoadmin==1.1.0
|
||||
django-autoadmin==1.1.1
|
||||
django-celery==3.1.17
|
||||
django-colorful==1.1.0
|
||||
django-compressor==2.0
|
||||
|
||||
Reference in New Issue
Block a user