Skip to content

Commit c145854

Browse files
committed
Merge branch 'dev' into 'master'
Dev See merge request CUBI_Engineering/CUBI_Data_Mgmt/sodar_core!60
2 parents fc74741 + e3eacec commit c145854

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+379
-116
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ node_modules/
6969
# User-uploaded media
7070
example_site/media/
7171

72-
7372
# Static files
7473
staticfiles/
7574

@@ -82,3 +81,6 @@ flamegraph.pl
8281
# Certificate files
8382
*.crt
8483
*.pem
84+
85+
# Celery
86+
celerybeat-schedule

CHANGELOG.rst

+50
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,56 @@ Changelog for the **SODAR Core** Django app package. Loosely follows the
77
Note that the issue IDs here refer to ones in the private CUBI GitLab.
88

99

10+
v0.5.1 (2019-04-16)
11+
===================
12+
13+
Added
14+
-----
15+
16+
- **General**
17+
- Bgjobs/Celery updates from Kiosc (#175)
18+
- Default error templates in ``projectroles/error/*.html`` (#210)
19+
- **Projectroles**
20+
- Optional ``user`` argument in ``ProjectAppPlugin.update_cache()`` (#203)
21+
- Migration for missing ``RemoteProject`` foreign keys (#197)
22+
- **Sodarcache**
23+
- API logging (#207)
24+
- Indexing of identifying fields (#218)
25+
26+
Changed
27+
-------
28+
29+
- **General**
30+
- Extend ``projectroles/base.html`` for all site app templates, update docs (#217)
31+
- Use projectroles error templates on the example site (#210)
32+
- **Sodarcache**
33+
- Make ``user`` field optional in models and API (#204)
34+
- Rename app configuration into ``SodarcacheConfig`` to follow naming conventions (#202)
35+
- Rename ``updatecache`` management command to ``synccache`` (#208)
36+
37+
Fixed
38+
-----
39+
40+
- **General**
41+
- Add missing curl dependency in ``install_os_dependencies.sh`` (#211)
42+
- Django debug toolbar not displayed when using local configuration (#213)
43+
- **Projectroles**
44+
- Nested app names not properly returned by ``utils.get_app_names()`` (#206)
45+
- Forced width set for all Bootstrap modals in ``projectroles.css`` (#209)
46+
- Long category paths breaking remote project list (#84)
47+
- Incorrect table rows displayed during project list initialization (#212)
48+
- Field ``project`` not set for source site ``RemoteProject`` objects (#197)
49+
- Crash from ``project_base.html`` in site app if not overriding title block (#216)
50+
51+
Removed
52+
-------
53+
54+
- **General**
55+
- Django debug toolbar workarounds from ``project.css`` and ``project.scss`` (#215)
56+
- **Projectroles**
57+
- ``PROJECTROLES_ADMIN_OWNER`` deprecation protection: use ``PROJECTROLES_DEFAULT_ADMIN`` (#190)
58+
59+
1060
v0.5.0 (2019-04-03)
1161
===================
1262

adminalerts/templates/adminalerts/adminalert_confirm_delete.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "projectroles/base.html" %}
1+
{% extends 'projectroles/base.html' %}
22

33
{% load rules %}
44

adminalerts/templates/adminalerts/adminalert_form.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "projectroles/base.html" %}
1+
{% extends 'projectroles/base.html' %}
22

33
{% load rules %}
44
{% load crispy_forms_filters %}

adminalerts/templates/adminalerts/alert_detail.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "projectroles/base.html" %}
1+
{% extends 'projectroles/base.html' %}
22

33
{# Projectroles dependency #}
44
{% load projectroles_common_tags %}

adminalerts/templates/adminalerts/alert_list.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "projectroles/base.html" %}
1+
{% extends 'projectroles/base.html' %}
22
{% load rules %}
33

44
{# Projectroles dependency #}

config/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This will make sure the app is always imported when
2+
# Django starts so that shared_task will use this app.
3+
4+
# TODO: Uncomment if your site uses celery and bgjobs
5+
6+
# from .celery import app as celery_app
7+
8+
# __all__ = ('celery_app',)

config/settings/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
# Background Jobs app
8484
'bgjobs.apps.BgjobsConfig',
8585
# External Data Cache app
86-
'sodarcache.apps.SodarCacheConfig',
86+
'sodarcache.apps.SodarcacheConfig',
8787
# Example project app
8888
'example_project_app.apps.ExampleProjectAppConfig',
8989
# Example site app

config/settings/local.py

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
INTERNAL_IPS += [ip[:-1] + '1']
6161

6262
DEBUG_TOOLBAR_CONFIG = {
63-
'SHOW_TOOLBAR_CALLBACK': lambda r: False,
6463
'DISABLE_PANELS': ['debug_toolbar.panels.redirects.RedirectsPanel'],
6564
'SHOW_TEMPLATE_CONTEXT': True,
6665
}

docs/source/app_projectroles_integration.rst

+11
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,17 @@ line:
287287
**mandatory** for Projectroles-based views to work without modifications.
288288

289289

290+
Site Error Templates
291+
====================
292+
293+
The projectroles app contains default error templates to use on your site.
294+
These are located in the ``projectroles/error/`` template directory. You can
295+
use them by entering ``{% extends 'projectroles/error/*.html %}`` in the
296+
corresponding files found in the ``{SITE_NAME}/templates/`` directory. You have
297+
the options of extending or replacing content on the templates, or simply
298+
implementing your own.
299+
300+
290301
All Done!
291302
=========
292303

docs/source/app_sodarcache_usage.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ management command.
110110

111111
.. code-block:: console
112112
113-
$ ./manage.py updatecache
113+
$ ./manage.py synccache
114114
115115
Similarly, there is a command to delete all cached data:
116116

docs/source/breaking_changes.rst

+43
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,49 @@ version. For a complete list of changes in the current release, see the
1313
be missing. Please click "display source" if you want to read this in GitLab.
1414

1515

16+
v0.5.1 (2019-04-16)
17+
===================
18+
19+
Site App Templates
20+
------------------
21+
22+
Templates for **site apps** should extend ``projectroles/base.html``. In earlier
23+
versions the documentation erroneously stated ``projectroles/project_base.html``
24+
as the base template to use. Extending that document does work in this version
25+
as long as you override the given template blocks. However, it is not
26+
recommended and may break in the future.
27+
28+
Sodarcache App Changes
29+
----------------------
30+
31+
The following potentially breaking changes have been made to the sodarcache app.
32+
33+
App configuration naming has been changed to
34+
``sodarcache.apps.SodarcacheConfig``. Please update ``config/settings/base.py``
35+
accordingly.
36+
37+
The field ``user`` has been made optional in models and the API.
38+
39+
An optional ``user`` argument has been added to
40+
``ProjectAppPlugin.update_cache()``. Correspondingly, the similar argument in
41+
``ProjectCacheAPI.set_cache_item()`` has been made optional. Please update your
42+
plugin implementations and function calls accordingly.
43+
44+
The ``updatecache`` management command has been renamed to ``synccache``.
45+
46+
Helper get_app_names() Fixed
47+
-----------------------------
48+
49+
The ``projectroles.utils.get_app_names()`` function will now return nested app
50+
names properly instead of omitting everything beyond the topmost module.
51+
52+
Default Admin Setting Deprecation Removed
53+
-----------------------------------------
54+
55+
The ``PROJECTROLES_ADMIN_OWNER`` setting no longer works. Use
56+
``PROJECTROLES_DEFAULT_ADMIN`` instead.
57+
58+
1659
v0.5.0 (2019-04-03)
1760
===================
1861

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# The short X.Y version
3030
version = '0.5'
3131
# The full version, including alpha/beta/rc tags
32-
release = '0.5.0'
32+
release = '0.5.1'
3333

3434

3535
# -- General configuration ---------------------------------------------------

docs/source/dev_site_app.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ allowed to access a view are properly redirected. Example:
117117
Templates
118118
=========
119119

120-
It is recommended for you to extend ``projectroles/project_base.html`` and put
121-
your actual app content within the ``projectroles`` block. Example:
120+
It is recommended for you to extend ``projectroles/base.html`` and put your
121+
actual app content within the ``projectroles`` block. Example:
122122

123123
.. code-block:: django
124124
125125
{# Projectroles dependency #}
126-
{% extends 'projectroles/project_base.html' %}
126+
{% extends 'projectroles/base.html' %}
127127
{% load projectroles_common_tags %}
128128
129129
{% block title %}
@@ -149,7 +149,7 @@ Site App Messages
149149
=================
150150

151151
The site app provides a way to display certain messages to users. For this, you
152-
need to implement ``get_mesasges()`` in the ``SiteAppPlugin`` class.
152+
need to implement ``get_messages()`` in the ``SiteAppPlugin`` class.
153153

154154
If you need to control e.g. which user should see the message or removal of a
155155
message after showing, you need to implement relevant logic in the function.

example_site/static/css/project.css

-9
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,3 @@
1111
background-color: #f2dede;
1212
border-color: #eed3d7;
1313
}
14-
15-
/* Display django-debug-toolbar.
16-
See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742
17-
and https://github.com/pydanny/cookiecutter-django/issues/317
18-
*/
19-
20-
[hidden][style="display: block;"] {
21-
display: block !important;
22-
}

example_site/static/sass/project.scss

-12
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,3 @@ $red: #b94a48;
3535
border-color: $dark-pink;
3636
color: $red;
3737
}
38-
39-
////////////////////////////////
40-
//Django Toolbar//
41-
////////////////////////////////
42-
43-
// Display django-debug-toolbar.
44-
// See https://github.com/django-debug-toolbar/django-debug-toolbar/issues/742
45-
// and https://github.com/pydanny/cookiecutter-django/issues/317
46-
47-
[hidden][style="display: block;"] {
48-
display: block !important;
49-
}

example_site/templates/403_csrf.html

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
{% extends "base.html" %}
2-
3-
{% block title %}Forbidden (403){% endblock %}
4-
5-
{% block content %}
6-
<h1>Forbidden (403)</h1>
7-
8-
<p>CSRF verification failed. Request aborted.</p>
9-
{% endblock content %}
1+
{# TODO: Extend as below, copy here and modify, or use your own template #}
2+
{% extends 'projectroles/error/403_csrf.html' %}

example_site/templates/404.html

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
{% extends "base.html" %}
2-
3-
{% block title %}Page not found{% endblock %}
4-
5-
{% block content %}
6-
<h1>Page not found</h1>
7-
8-
<p>This is not the page you were looking for.</p>
9-
{% endblock content %}
1+
{# TODO: Extend as below, copy here and modify, or use your own template #}
2+
{% extends 'projectroles/error/404.html' %}

example_site/templates/500.html

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
{% extends "base.html" %}
2-
3-
{% block title %}Server Error{% endblock %}
4-
5-
{% block content %}
6-
<h1>Ooops!!! 500</h1>
7-
8-
<h3>Looks like something went wrong!</h3>
9-
10-
<p>We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.</p>
11-
{% endblock content %}
12-
13-
1+
{# TODO: Extend as below, copy here and modify, or use your own template #}
2+
{% extends 'projectroles/error/500.html' %}

example_site_app/templates/example_site_app/example.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{# Projectroles dependency #}
2-
{% extends 'projectroles/project_base.html' %}
2+
{% extends 'projectroles/base.html' %}
33
{% load projectroles_common_tags %}
44

55
{% block title %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.20 on 2019-04-15 11:50
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
7+
8+
def fix_project_keys(apps, schema_editor):
9+
""" Fix missing RemoteProject.project foreign keys (issue #197)"""
10+
RemoteProject = apps.get_model('projectroles', 'RemoteProject')
11+
Project = apps.get_model('projectroles', 'Project')
12+
13+
for rp in RemoteProject.objects.all():
14+
if not rp.project:
15+
rp.project = Project.objects.filter(
16+
sodar_uuid=rp.project_uuid
17+
).first()
18+
rp.save()
19+
20+
21+
class Migration(migrations.Migration):
22+
23+
dependencies = [
24+
('projectroles', '0006_add_remote_projects'),
25+
]
26+
27+
operations = [
28+
migrations.RunPython(fix_project_keys),
29+
]

projectroles/plugins.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,13 @@ def search(self, search_term, user, search_type=None, keywords=None):
156156
}
157157
}
158158

159-
def update_cache(self, name=None, project=None):
159+
def update_cache(self, name=None, project=None, user=None):
160160
"""
161161
Update cached data for this app, limitable to item ID and/or project.
162162
163-
:param project: Project object to limit update to (optional)
164163
:param name: Item name to limit update to (string, optional)
164+
:param project: Project object to limit update to (optional)
165+
:param user: User object to denote user triggering the update (optional)
165166
"""
166167
# TODO: Implement this in your app plugin
167168
return None

projectroles/remote_projects.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def _sync_project(self, uuid, p_data):
560560
# Create/update a RemoteProject object
561561
try:
562562
remote_project = RemoteProject.objects.get(
563-
site=self.source_site, project_uuid=project.sodar_uuid
563+
site=self.source_site, project=project
564564
)
565565
remote_project.level = p_data['level']
566566
remote_project.project = project
@@ -704,15 +704,10 @@ def sync_source_data(self, site, remote_data, request=None):
704704
self.updated_parents = []
705705

706706
# Get default owner if remote projects have a local owner
707-
708-
if hasattr(settings, 'PROJECTROLES_DEFAULT_ADMIN'):
709-
admin_username = settings.PROJECTROLES_DEFAULT_ADMIN
710-
711-
else: # Avoiding crash if the variable is not renamed, will be removed
712-
admin_username = settings.PROJECTROLES_ADMIN_OWNER
713-
714707
try:
715-
self.default_owner = User.objects.get(username=admin_username)
708+
self.default_owner = User.objects.get(
709+
username=settings.PROJECTROLES_DEFAULT_ADMIN
710+
)
716711

717712
except User.DoesNotExist:
718713
error_msg = (

projectroles/static/projectroles/css/projectroles.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ img.sodar-navbar-logo {
611611
padding-left: 16px;
612612
}
613613

614-
.modal-dialog{
614+
div#sodar-modal div.modal-dialog{
615615
min-width: 600px;
616616
max-width: 75%;
617617
}

0 commit comments

Comments
 (0)