Merge branch 'master' into stable

remotes/origin/logger 1.9.0
Alejandro Alonso 2015-11-02 09:36:13 +01:00
commit 624f27e095
451 changed files with 29786 additions and 5186 deletions

View File

@ -2,6 +2,7 @@ sudo: false
language: python language: python
python: python:
- "3.4" - "3.4"
- "3.5"
services: services:
- rabbitmq # will start rabbitmq-server - rabbitmq # will start rabbitmq-server
cache: cache:

View File

@ -7,21 +7,23 @@ The PRIMARY AUTHORS are:
- Xavi Julian <xavier.julian@kaleidos.net> - Xavi Julian <xavier.julian@kaleidos.net>
- Anler Hernández <hello@anler.me> - Anler Hernández <hello@anler.me>
Special thanks to Kaleidos Open Source S.L. for provice time for taiga Special thanks to Kaleidos Open Source S.L. for provice time for Taiga
development. development.
And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS --
people who have submitted patches, reported bugs, added translations, helped people who have submitted patches, reported bugs, added translations, helped
answer newbie questions, and generally made taiga that much better: answer newbie questions, and generally made taiga that much better:
- Andrés Moya <andres.moya@kaleidos.net>
- Yamila Moreno <yamila.moreno@kaleidos.net>
- Ricky Posner <e@eposner.com>
- Alonso Torres <alonso.torres@kaleidos.net>
- Alejandro Gómez <alejandro.gomez@kaleidos.net> - Alejandro Gómez <alejandro.gomez@kaleidos.net>
- Alonso Torres <alonso.torres@kaleidos.net>
- Andrea Stagi <stagi.andrea@gmail.com> - Andrea Stagi <stagi.andrea@gmail.com>
- Hector Colina <hcolina@gmail.com> - Andrés Moya <andres.moya@kaleidos.net>
- Julien Palard - Andrey Alekseenko <al42and@gmail.com>
- Joe Letts
- Chris Wilson <chris.wilson@aridhia.com> - Chris Wilson <chris.wilson@aridhia.com>
- David Burke <david@burkesoftware.com>
- Hector Colina <hcolina@gmail.com>
- Joe Letts
- Julien Palard
- Ricky Posner <e@eposner.com>
- Yamila Moreno <yamila.moreno@kaleidos.net>
- Brett Profitt <brett.profitt@gmail.com>

View File

@ -1,6 +1,44 @@
# Changelog # # Changelog #
## 1.9.0 Abies Siberica (2015-11-XX)
### Features
- Project can be starred or unstarred and the fans list can be obtained.
- US, tasks and Issues can be upvoted or downvoted and the voters list can be obtained.
- Now users can watch public issues, tasks and user stories.
- Add endpoints to show the watchers list for issues, tasks and user stories.
- Add a "field type" property for custom fields: 'text', 'multiline text' and 'date' right now (thanks to [@artlepool](https://github.com/artlepool)).
- Allow multiple actions in the commit messages.
- Now every user that coments USs, Issues or Tasks will be involved in it (add author to the watchers list).
- Now profile timelines only show content about the objects (US/Tasks/Issues/Wiki pages) you are involved.
- Add custom videoconference system.
- Fix the compatibility with BitBucket webhooks and add issues and issues comments integration.
- Add support for comments in the Gitlab webhooks integration.
- Add externall apps: now Taiga can integrate with hundreds of applications and service.
- Improve searching system, now full text searchs are supported
- Add sha1 hash to attachments to verify the integrity of files (thanks to [@astagi](https://github.com/astagi)).
- i18n.
- Add italian (it) translation.
- Add polish (pl) translation.
- Add portuguese (Brazil) (pt_BR) translation.
- Add russian (ru) translation.
### Misc
- Made compatible with python 3.5.
- Migrated to django 1.8.
- Update the rest of requirements to the last version.
- Improve export system, now is more efficient and prevents possible crashes with heavy projects.
- API: Mixin fields 'users', 'members' and 'memberships' in ProjectDetailSerializer.
- API: Add stats/system resource with global server stats (total project, total users....)
- API: Improve and fix some errors in issues/filters_data and userstories/filters_data.
- API: resolver suport ref GET param and return a story, task or issue.
- Webhooks: Add deleted datetime to webhooks responses when isues, tasks or USs are deleted.
- Add headers to allow threading for notification emails about changes to issues, tasks, user stories, and wiki pages. (thanks to [@brett](https://github.com/brettp)).
- Lots of small and not so small bugfixes.
## 1.8.0 Saracenia Purpurea (2015-06-18) ## 1.8.0 Saracenia Purpurea (2015-06-18)
### Features ### Features

View File

@ -4,6 +4,80 @@
[![Managed with Taiga.io](https://taiga.io/media/support/attachments/article-22/banner-gh.png)](https://taiga.io "Managed with Taiga.io") [![Managed with Taiga.io](https://taiga.io/media/support/attachments/article-22/banner-gh.png)](https://taiga.io "Managed with Taiga.io")
[![Build Status](https://travis-ci.org/taigaio/taiga-back.svg?branch=master)](https://travis-ci.org/taigaio/taiga-back "Build Status") [![Build Status](https://travis-ci.org/taigaio/taiga-back.svg?branch=master)](https://travis-ci.org/taigaio/taiga-back "Build Status")
[![Coverage Status](https://coveralls.io/repos/taigaio/taiga-back/badge.svg?branch=master)](https://coveralls.io/r/taigaio/taiga-back?branch=master "Coverage Status") [![Coverage Status](https://coveralls.io/repos/taigaio/taiga-back/badge.svg?branch=master)](https://coveralls.io/r/taigaio/taiga-back?branch=master "Coverage Status")
[![Dependency Status](https://www.versioneye.com/user/projects/561bd091a193340f32001464/badge.svg?style=flat)](https://www.versioneye.com/user/projects/561bd091a193340f32001464)
## Contribute to Taiga ##
#### Where to start ####
There are many different ways to contribute to Taiga's development, just find the one that best fits with your skills. Examples of contributions we would love to receive include:
- **Code patches**
- **Documentation improvements**
- **Translations**
- **Bug reports**
- **Patch reviews**
- **UI enhancements**
Big features are also welcome but if you want to see your contributions included in Taiga codebase we strongly recommend you start by initiating a chat though our [mailing list](http://groups.google.co.uk/d/forum/taigaio)
#### License ####
Every code patch accepted in taiga codebase is licensed under [AGPL v3.0](http://www.gnu.org/licenses/agpl-3.0.html). You should must be careful to not include any code that can not be licensed under this license.
Please read carefully [our license](https://github.com/taigaio/taiga-back/blob/master/LICENSE) and ask us if you have any questions.
#### Bug reports, enhancements and support ####
If you **nedd help to setup Taiga**, you want to **talk about some cool enhancemnt** or you have **some questions** please write us to our [mailing list](http://groups.google.com/d/forum/taigaio).
If you **find a bug** in Taiga you can always report it:
- in our [mailing list](http://groups.google.com/d/forum/taigaio).
- in [github issues](https://github.com/taigaio/taiga-back/issues).
- send us a mail to support@taiga.io if is a bug related to tree.taiga.io.
- send a mail to security@taiga.io if is a **security bug**.
One of our fellow Taiga developers will search, find and hunt it as soon as possible.
Please, before reporting an bug write down how can we reproduce it, your operating system, your browser and version, and if it's possible, a screenshot. Sometimes it take less time to fix a bug if the developer know how to find it and we will solve your problem as fast as possible.
#### Documentation improvements ####
We are gathering lots of information from our users to build and enhance our documentation. If you are the documentation to install or develop with Taiga and find any mistakes, omissions or confused sequences, it is enormously helpful to report it. Or better still, if you believe you can author additions, please make a pull-request to taiga project.
Currently, we have authored three main documentation hubs:
- **[API Docs](https://github.com/taigaio/taiga-doc)**: Our API documentation and reference for developing from Taiga API.
- **[Installation Guide](https://github.com/taigaio/taiga-doc)**: If you need to install Taiga on your own server, this is the place to find some guides.
- **[Taiga Support](https://github.com/taigaio/taiga-doc)**: This page is intended to be the support reference page for the users. If you find any mistake, please report it.
#### Translation ####
We are ready now to accept your help translating Taiga. It's easy (and fun!) just access to our team of translators with the link below, set up an account in Transifex and start contributing. Join us to make sure your language is covered! **[Help Taiga to trasnlate content](https://www.transifex.com/signup/ "Help Taiga to trasnlatecontent")**
#### Code patches ####
Taiga will always be glad to receive code patches to update, fix or improve its code.
If you know how to improve our code base or you found a bug, a security vulnerabilities a performance issue and you think you can solve, we will be very happy to accept your pull-request. If your code requires considerable changes, we recommend you first talk to us directly. We will find the best way to help.
#### UI enhancements ####
Taiga is made for developers and designers. We care enormously about UI because usability and design are both critical aspects of the Taiga experience.
There are two possible ways to contribute to our UI:
- **Bugs**: If you find a bug regarding front-end, please report it as previously indicated in the Bug reports section or send a pull-request as indicated in the Code Patches section.
- **Enhancements**: If its a design or UX bug or enhancement we will love to receive your feedback. Please send us your enhancement, with the reason and, if it's possible, an example. Our design and UX team will review your enhancement and fix it as soon as possible. We recommend you to use our [mailing list](http://groups.google.co.uk/d/forum/taigaio){target="_blank"} so we can have a lot of different opinions and debate.
- **Language Localization**: We are eager to offer localized versions of Taiga. Some members of the community have already volunteered to work to provide a variety of languages. We are working to implement some changes to allow for this and expect to accept these requests in the near future.
## Setup development environment ## ## Setup development environment ##
@ -24,15 +98,3 @@ Initial auth data: admin/123123
If you want a complete environment for production usage, you can try the taiga bootstrapping If you want a complete environment for production usage, you can try the taiga bootstrapping
scripts https://github.com/taigaio/taiga-scripts (warning: alpha state). All the information about the different installation methods (production, development, vagrant, docker...) can be found here http://taigaio.github.io/taiga-doc/dist/#_installation_guide. scripts https://github.com/taigaio/taiga-scripts (warning: alpha state). All the information about the different installation methods (production, development, vagrant, docker...) can be found here http://taigaio.github.io/taiga-doc/dist/#_installation_guide.
## Community ##
[Taiga has a mailing list](http://groups.google.com/d/forum/taigaio). Feel free to join it and ask any questions you may have.
To subscribe for announcements of releases, important changes and so on, please follow [@taigaio](https://twitter.com/taigaio) on Twitter.
## Donations ##
We are grateful for your emails volunteering donations to Taiga. We feel comfortable accepting them under these conditions: The first that we will only do so while we are in the current beta / pre-revenue stage and that whatever money is donated will go towards a bounty fund. Starting Q2 2015 we will be engaging much more actively with our community to help further the development of Taiga, and we will use these donations to reward people working alongside us.
If you wish to make a donation to this Taiga fund, you can do so via http://www.paypal.com using the email: eposner@taiga.io

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -6,16 +6,12 @@ dropdb taiga
echo "-> Create taiga DB" echo "-> Create taiga DB"
createdb taiga createdb taiga
echo "-> Run syncdb" echo "-> Load migrations"
python manage.py migrate python manage.py migrate
# echo "-> Load initial Site" echo "-> Load initial user (admin/123123)"
# python manage.py loaddata initial_site --traceback
echo "-> Load initial user"
python manage.py loaddata initial_user --traceback python manage.py loaddata initial_user --traceback
echo "-> Load initial project_templates" echo "-> Load initial project_templates (scrum/kanban)"
python manage.py loaddata initial_project_templates --traceback python manage.py loaddata initial_project_templates --traceback
echo "-> Load initial roles"
python manage.py loaddata initial_role --traceback
echo "-> Generate sample data" echo "-> Generate sample data"
python manage.py sample_data --traceback python manage.py sample_data --traceback
echo "-> Rebuilding timeline" echo "-> Rebuilding timeline"

View File

@ -1,13 +1,13 @@
-r requirements.txt -r requirements.txt
factory_boy==2.4.1 factory_boy==2.6.0
py==1.4.26 py==1.4.30
pytest==2.6.4 pytest==2.8.2
pytest-django==2.8.0 pytest-django==2.9.1
pytest-pythonpath==0.6 pytest-pythonpath==0.7
coverage==3.7.1 coverage==4.0.1
coveralls==0.4.2 coveralls==1.1
django-slowdown==0.0.1 django-slowdown==0.0.1
transifex-client==0.11.1.beta transifex-client==0.11.1.beta

View File

@ -1,36 +1,35 @@
Django==1.7.8 Django==1.8.5
#djangorestframework==2.3.13 # It's not necessary since Taiga 1.7 #djangorestframework==2.3.13 # It's not necessary since Taiga 1.7
django-picklefield==0.3.1 django-picklefield==0.3.2
django-sampledatahelper==0.2.2 django-sampledatahelper==0.3.0
gunicorn==19.3.0 gunicorn==19.3.0
psycopg2==2.5.4 psycopg2==2.6.1
pillow==2.5.3 Pillow==3.0.0
pytz==2014.4 pytz==2015.7
six==1.8.0 six==1.10.0
amqp==1.4.6 amqp==1.4.7
djmail==0.10 djmail==0.11
django-pgjson==0.2.2 django-pgjson==0.3.1
djorm-pgarray==1.0.4 djorm-pgarray==1.2
django-jinja==1.0.4 django-jinja==1.4.1
jinja2==2.7.2 jinja2==2.8
pygments==1.6 pygments==2.0.2
django-sites==0.8 django-sites==0.8
Markdown==2.4.1 Markdown==2.6.3
fn==0.2.13 fn==0.4.3
diff-match-patch==20121119 diff-match-patch==20121119
requests==2.4.1 requests==2.8.1
django-sr==0.0.4 django-sr==0.0.4
easy-thumbnails==2.1 easy-thumbnails==2.2
celery==3.1.17 celery==3.1.19
redis==2.10.3 redis==2.10.3
Unidecode==0.04.16 Unidecode==0.04.18
raven==5.1.1 raven==5.8.1
bleach==1.4 bleach==1.4.2
django-ipware==0.1.0 django-ipware==1.1.1
premailer==2.8.1 premailer==2.9.6
django-transactional-cleanup==0.1.14 cssutils==1.0.1 # Compatible with python 3.5
lxml==3.4.1 django-transactional-cleanup==0.1.15
lxml==3.5.0b1
git+https://github.com/Xof/django-pglocks.git@dbb8d7375066859f897604132bd437832d2014ea git+https://github.com/Xof/django-pglocks.git@dbb8d7375066859f897604132bd437832d2014ea
pyjwkest==1.0.7
# Comment it if you are using python >= 3.4
enum34==1.0

View File

@ -84,6 +84,7 @@ def update_catalogs(resources=None, languages=None):
cmd = makemessages.Command() cmd = makemessages.Command()
opts = { opts = {
"locale": ["en"], "locale": ["en"],
"exclude": [],
"extensions": ["py", "jinja"], "extensions": ["py", "jinja"],
# Default values # Default values
@ -96,7 +97,7 @@ def update_catalogs(resources=None, languages=None):
"no_location": False, "no_location": False,
"no_obsolete": False, "no_obsolete": False,
"keep_pot": False, "keep_pot": False,
"verbosity": "0", "verbosity": 0,
} }
if resources is not None: if resources is not None:

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -25,6 +25,8 @@ ADMINS = (
("Admin", "example@example.com"), ("Admin", "example@example.com"),
) )
DEBUG = False
DATABASES = { DATABASES = {
"default": { "default": {
"ENGINE": "transaction_hooks.backends.postgresql_psycopg2", "ENGINE": "transaction_hooks.backends.postgresql_psycopg2",
@ -105,7 +107,7 @@ LANGUAGES = [
#("id", "Bahasa Indonesia"), # Indonesian #("id", "Bahasa Indonesia"), # Indonesian
#("io", "IDO"), # Ido #("io", "IDO"), # Ido
#("is", "Íslenska"), # Icelandic #("is", "Íslenska"), # Icelandic
#("it", "Italiano"), # Italian ("it", "Italiano"), # Italian
#("ja", "日本語"), # Japanese #("ja", "日本語"), # Japanese
#("ka", "ქართული"), # Georgian #("ka", "ქართული"), # Georgian
#("kk", "Қазақша"), # Kazakh #("kk", "Қазақша"), # Kazakh
@ -126,11 +128,11 @@ LANGUAGES = [
#("nn", "Norsk (nynorsk)"), # Norwegian Nynorsk #("nn", "Norsk (nynorsk)"), # Norwegian Nynorsk
#("os", "Ирон æвзаг"), # Ossetic #("os", "Ирон æвзаг"), # Ossetic
#("pa", "ਪੰਜਾਬੀ"), # Punjabi #("pa", "ਪੰਜਾਬੀ"), # Punjabi
#("pl", "Polski"), # Polish ("pl", "Polski"), # Polish
#("pt", "Português (Portugal)"), # Portuguese #("pt", "Português (Portugal)"), # Portuguese
#("pt-br", "Português (Brasil)"), # Brazilian Portuguese ("pt-br", "Português (Brasil)"), # Brazilian Portuguese
#("ro", "Română"), # Romanian #("ro", "Română"), # Romanian
#("ru", "Русский"), # Russian ("ru", "Русский"), # Russian
#("sk", "Slovenčina"), # Slovak #("sk", "Slovenčina"), # Slovak
#("sl", "Slovenščina"), # Slovenian #("sl", "Slovenščina"), # Slovenian
#("sq", "Shqip"), # Albanian #("sq", "Shqip"), # Albanian
@ -191,9 +193,6 @@ MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
# urls depends on it. On production should be set # urls depends on it. On production should be set
# something like https://media.taiga.io/ # something like https://media.taiga.io/
MEDIA_URL = "http://localhost:8000/media/" MEDIA_URL = "http://localhost:8000/media/"
# Static url is not widelly used by taiga (only
# if admin is activated).
STATIC_URL = "http://localhost:8000/static/" STATIC_URL = "http://localhost:8000/static/"
# Static configuration. # Static configuration.
@ -215,11 +214,47 @@ DEFAULT_FILE_STORAGE = "taiga.base.storage.FileSystemStorage"
SECRET_KEY = "aw3+t2r(8(0kkrhg8)gx6i96v5^kv%6cfep9wxfom0%7dy0m9e" SECRET_KEY = "aw3+t2r(8(0kkrhg8)gx6i96v5^kv%6cfep9wxfom0%7dy0m9e"
TEMPLATE_LOADERS = [ TEMPLATES = [
"django_jinja.loaders.AppLoader", {
"django_jinja.loaders.FileSystemLoader", "BACKEND": "django_jinja.backend.Jinja2",
"DIRS": [
os.path.join(BASE_DIR, "templates"),
],
"APP_DIRS": True,
"OPTIONS": {
'context_processors': [
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.request",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
],
"match_extension": ".jinja",
}
},
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
os.path.join(BASE_DIR, "templates"),
],
"APP_DIRS": True,
"OPTIONS": {
'context_processors': [
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.request",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
],
}
},
] ]
MIDDLEWARE_CLASSES = [ MIDDLEWARE_CLASSES = [
"taiga.base.middleware.cors.CoorsMiddleware", "taiga.base.middleware.cors.CoorsMiddleware",
"taiga.events.middleware.SessionIDMiddleware", "taiga.events.middleware.SessionIDMiddleware",
@ -234,22 +269,9 @@ MIDDLEWARE_CLASSES = [
"django.contrib.messages.middleware.MessageMiddleware", "django.contrib.messages.middleware.MessageMiddleware",
] ]
TEMPLATE_CONTEXT_PROCESSORS = [
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.request",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
]
ROOT_URLCONF = "taiga.urls" ROOT_URLCONF = "taiga.urls"
TEMPLATE_DIRS = [
os.path.join(BASE_DIR, "templates"),
]
INSTALLED_APPS = [ INSTALLED_APPS = [
"django.contrib.auth", "django.contrib.auth",
"django.contrib.contenttypes", "django.contrib.contenttypes",
@ -266,12 +288,14 @@ INSTALLED_APPS = [
"taiga.front", "taiga.front",
"taiga.users", "taiga.users",
"taiga.userstorage", "taiga.userstorage",
"taiga.external_apps",
"taiga.projects", "taiga.projects",
"taiga.projects.references", "taiga.projects.references",
"taiga.projects.custom_attributes", "taiga.projects.custom_attributes",
"taiga.projects.history", "taiga.projects.history",
"taiga.projects.notifications", "taiga.projects.notifications",
"taiga.projects.attachments", "taiga.projects.attachments",
"taiga.projects.likes",
"taiga.projects.votes", "taiga.projects.votes",
"taiga.projects.milestones", "taiga.projects.milestones",
"taiga.projects.userstories", "taiga.projects.userstories",
@ -384,6 +408,9 @@ REST_FRAMEWORK = {
# Mainly used for api debug. # Mainly used for api debug.
"taiga.auth.backends.Session", "taiga.auth.backends.Session",
# Application tokens auth
"taiga.external_apps.auth_backends.Token",
), ),
"DEFAULT_THROTTLE_CLASSES": ( "DEFAULT_THROTTLE_CLASSES": (
"taiga.base.throttling.AnonRateThrottle", "taiga.base.throttling.AnonRateThrottle",
@ -403,6 +430,11 @@ REST_FRAMEWORK = {
"DATETIME_FORMAT": "%Y-%m-%dT%H:%M:%S%z" "DATETIME_FORMAT": "%Y-%m-%dT%H:%M:%S%z"
} }
# Extra expose header related to Taiga APP (see taiga.base.middleware.cors=)
APP_EXTRA_EXPOSE_HEADERS = [
"taiga-info-total-opened-milestones",
"taiga-info-total-closed-milestones"
]
DEFAULT_PROJECT_TEMPLATE = "scrum" DEFAULT_PROJECT_TEMPLATE = "scrum"
PUBLIC_REGISTER_ENABLED = False PUBLIC_REGISTER_ENABLED = False

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -17,8 +17,5 @@
from .common import * from .common import *
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG
TEMPLATE_CONTEXT_PROCESSORS += [ TEMPLATES[0]["OPTIONS"]['context_processors'] += "django.template.context_processors.debug"
"django.core.context_processors.debug",
]

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -16,6 +16,12 @@
from .development import * from .development import *
#DEBUG = False
#ADMINS = (
# ("Admin", "example@example.com"),
#)
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'transaction_hooks.backends.postgresql_psycopg2', 'ENGINE': 'transaction_hooks.backends.postgresql_psycopg2',
@ -27,11 +33,25 @@ DATABASES = {
} }
} }
#HOST="http://taiga.projects.kaleidos.net" #SITES = {
# # "api": {
# "scheme": "http",
# "domain": "localhost:8000",
# "name": "api"
# },
# "front": {
# "scheme": "http",
# "domain": "localhost:9001",
# "name": "front"
# },
#}
#SITE_ID = "api"
#MEDIA_ROOT = '/home/taiga/media' #MEDIA_ROOT = '/home/taiga/media'
#STATIC_ROOT = '/home/taiga/static' #STATIC_ROOT = '/home/taiga/static'
# EMAIL SETTINGS EXAMPLE # EMAIL SETTINGS EXAMPLE
#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' #EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
#EMAIL_USE_TLS = False #EMAIL_USE_TLS = False

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,5 +1,5 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -28,9 +28,8 @@ from django.db import transaction as tx
from django.db import IntegrityError from django.db import IntegrityError
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from djmail.template_mail import MagicMailBuilder, InlineCSSTemplateMail
from taiga.base import exceptions as exc from taiga.base import exceptions as exc
from taiga.base.mails import mail_builder
from taiga.users.serializers import UserAdminSerializer from taiga.users.serializers import UserAdminSerializer
from taiga.users.services import get_and_validate_user from taiga.users.services import get_and_validate_user
@ -57,8 +56,7 @@ def send_register_email(user) -> bool:
""" """
cancel_token = get_token_for_user(user, "cancel_account") cancel_token = get_token_for_user(user, "cancel_account")
context = {"user": user, "cancel_token": cancel_token} context = {"user": user, "cancel_token": cancel_token}
mbuilder = MagicMailBuilder(template_mail_cls=InlineCSSTemplateMail) email = mail_builder.registered_user(user, context)
email = mbuilder.registered_user(user, context)
return bool(email.send()) return bool(email.send())

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -31,9 +31,11 @@ from .viewsets import ModelCrudViewSet
from .viewsets import ModelUpdateRetrieveViewSet from .viewsets import ModelUpdateRetrieveViewSet
from .viewsets import GenericViewSet from .viewsets import GenericViewSet
from .viewsets import ReadOnlyListViewSet from .viewsets import ReadOnlyListViewSet
from .viewsets import ModelRetrieveViewSet
__all__ = ["ModelCrudViewSet", __all__ = ["ModelCrudViewSet",
"ModelListViewSet", "ModelListViewSet",
"ModelUpdateRetrieveViewSet", "ModelUpdateRetrieveViewSet",
"GenericViewSet", "GenericViewSet",
"ReadOnlyListViewSet"] "ReadOnlyListViewSet",
"ModelRetrieveViewSet"]

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -85,7 +85,7 @@ class GenericAPIView(pagination.PaginationMixin,
many=many, partial=partial, context=context) many=many, partial=partial, context=context)
def filter_queryset(self, queryset): def filter_queryset(self, queryset, filter_backends=None):
""" """
Given a queryset, filter it with whichever filter backend is in use. Given a queryset, filter it with whichever filter backend is in use.
@ -94,7 +94,10 @@ class GenericAPIView(pagination.PaginationMixin,
method if you want to apply the configured filtering backend to the method if you want to apply the configured filtering backend to the
default queryset. default queryset.
""" """
for backend in self.get_filter_backends(): #NOTE TAIGA: Added filter_backends to overwrite the default behavior.
backends = filter_backends or self.get_filter_backends()
for backend in backends:
queryset = backend().filter_queryset(self.request, queryset, self) queryset = backend().filter_queryset(self.request, queryset, self)
return queryset return queryset

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -1005,7 +1005,7 @@ class ModelSerializer((six.with_metaclass(SerializerMetaclass, BaseSerializer)))
m2m_data[field_name] = attrs.pop(field_name) m2m_data[field_name] = attrs.pop(field_name)
# Forward m2m relations # Forward m2m relations
for field in meta.many_to_many + meta.virtual_fields: for field in list(meta.many_to_many) + meta.virtual_fields:
if field.name in attrs: if field.name in attrs:
m2m_data[field.name] = attrs.pop(field.name) m2m_data[field.name] = attrs.pop(field.name)

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> * Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
* Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> * Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
* Copyright (C) 2015 David Barragán <bameda@dbarragan.com> * Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> * Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
* Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> * Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
* Copyright (C) 2015 David Barragán <bameda@dbarragan.com> * Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> * Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
* Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> * Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
* Copyright (C) 2015 David Barragán <bameda@dbarragan.com> * Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> * Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
* Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> * Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
* Copyright (C) 2015 David Barragán <bameda@dbarragan.com> * Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> * Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
* Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> * Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
* Copyright (C) 2015 David Barragán <bameda@dbarragan.com> * Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -447,7 +447,7 @@ class APIView(View):
def api_server_error(request, *args, **kwargs): def api_server_error(request, *args, **kwargs):
if settings.DEBUG is False and request.META['CONTENT_TYPE'] == "application/json": if settings.DEBUG is False and request.META.get('CONTENT_TYPE', None) == "application/json":
return HttpResponse(json.dumps({"error": _("Server application error")}), return HttpResponse(json.dumps({"error": _("Server application error")}),
status=status.HTTP_500_INTERNAL_SERVER_ERROR) status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return server_error(request, *args, **kwargs) return server_error(request, *args, **kwargs)

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -167,3 +167,7 @@ class ModelUpdateRetrieveViewSet(mixins.UpdateModelMixin,
mixins.RetrieveModelMixin, mixins.RetrieveModelMixin,
GenericViewSet): GenericViewSet):
pass pass
class ModelRetrieveViewSet(mixins.RetrieveModelMixin,
GenericViewSet):
pass

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -110,3 +110,12 @@ class TagsColorsField(serializers.WritableField):
def from_native(self, data): def from_native(self, data):
return list(data.items()) return list(data.items())
class WatchersField(serializers.WritableField):
def to_native(self, obj):
return obj
def from_native(self, data):
return data

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -18,17 +18,23 @@ from functools import reduce
import logging import logging
from django.apps import apps from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q from django.db.models import Q
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from taiga.base import exceptions as exc from taiga.base import exceptions as exc
from taiga.base.api.utils import get_object_or_404 from taiga.base.api.utils import get_object_or_404
from taiga.base.utils.db import to_tsquery
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
#####################################################################
# Base and Mixins
#####################################################################
class BaseFilterBackend(object): class BaseFilterBackend(object):
""" """
A base class from which all filter backend classes should inherit. A base class from which all filter backend classes should inherit.
@ -95,6 +101,9 @@ class OrderByFilterMixin(QueryParamsFilterMixin):
if field_name not in order_by_fields: if field_name not in order_by_fields:
return queryset return queryset
if raw_fieldname in ["owner", "-owner", "assigned_to", "-assigned_to"]:
raw_fieldname = "{}__full_name".format(raw_fieldname)
return super().filter_queryset(request, queryset.order_by(raw_fieldname), view) return super().filter_queryset(request, queryset.order_by(raw_fieldname), view)
@ -105,6 +114,10 @@ class FilterBackend(OrderByFilterMixin):
pass pass
#####################################################################
# Permissions filters
#####################################################################
class PermissionBasedFilterBackend(FilterBackend): class PermissionBasedFilterBackend(FilterBackend):
permission = None permission = None
@ -345,9 +358,84 @@ class IsProjectAdminFromWebhookLogFilterBackend(FilterBackend, BaseIsProjectAdmi
return super().filter_queryset(request, queryset, view) return super().filter_queryset(request, queryset, view)
#####################################################################
# Generic Attributes filters
#####################################################################
class BaseRelatedFieldsFilter(FilterBackend):
def __init__(self, filter_name=None):
if filter_name:
self.filter_name = filter_name
def _prepare_filter_data(self, query_param_value):
def _transform_value(value):
try:
return int(value)
except:
if value in self._special_values_dict:
return self._special_values_dict[value]
raise exc.BadRequest()
values = set([x.strip() for x in query_param_value.split(",")])
values = map(_transform_value, values)
return list(values)
def _get_queryparams(self, params):
raw_value = params.get(self.filter_name, None)
if raw_value:
value = self._prepare_filter_data(raw_value)
if None in value:
qs_in_kwargs = {"{}__in".format(self.filter_name): [v for v in value if v is not None]}
qs_isnull_kwargs = {"{}__isnull".format(self.filter_name): True}
return Q(**qs_in_kwargs) | Q(**qs_isnull_kwargs)
else:
return {"{}__in".format(self.filter_name): value}
return None
def filter_queryset(self, request, queryset, view):
query = self._get_queryparams(request.QUERY_PARAMS)
if query:
if isinstance(query, dict):
queryset = queryset.filter(**query)
else:
queryset = queryset.filter(query)
return super().filter_queryset(request, queryset, view)
class OwnersFilter(BaseRelatedFieldsFilter):
filter_name = 'owner'
class AssignedToFilter(BaseRelatedFieldsFilter):
filter_name = 'assigned_to'
class StatusesFilter(BaseRelatedFieldsFilter):
filter_name = 'status'
class IssueTypesFilter(BaseRelatedFieldsFilter):
filter_name = 'type'
class PrioritiesFilter(BaseRelatedFieldsFilter):
filter_name = 'priority'
class SeveritiesFilter(BaseRelatedFieldsFilter):
filter_name = 'severity'
class TagsFilter(FilterBackend): class TagsFilter(FilterBackend):
def __init__(self, filter_name='tags'): filter_name = 'tags'
self.filter_name = filter_name
def __init__(self, filter_name=None):
if filter_name:
self.filter_name = filter_name
def _get_tags_queryparams(self, params): def _get_tags_queryparams(self, params):
tags = params.get(self.filter_name, None) tags = params.get(self.filter_name, None)
@ -364,35 +452,46 @@ class TagsFilter(FilterBackend):
return super().filter_queryset(request, queryset, view) return super().filter_queryset(request, queryset, view)
class StatusFilter(FilterBackend):
def __init__(self, filter_name='status'):
self.filter_name = filter_name
def _get_status_queryparams(self, params): class WatchersFilter(FilterBackend):
status = params.get(self.filter_name, None) filter_name = 'watchers'
if status is not None:
status = set([x.strip() for x in status.split(",")]) def __init__(self, filter_name=None):
return list(status) if filter_name:
self.filter_name = filter_name
def _get_watchers_queryparams(self, params):
watchers = params.get(self.filter_name, None)
if watchers:
return watchers.split(",")
return None return None
def filter_queryset(self, request, queryset, view): def filter_queryset(self, request, queryset, view):
query_status = self._get_status_queryparams(request.QUERY_PARAMS) query_watchers = self._get_watchers_queryparams(request.QUERY_PARAMS)
if query_status: model = queryset.model
queryset = queryset.filter(status__in=query_status) if query_watchers:
WatchedModel = apps.get_model("notifications", "Watched")
watched_type = ContentType.objects.get_for_model(queryset.model)
watched_ids = WatchedModel.objects.filter(content_type=watched_type, user__id__in=query_watchers).values_list("object_id", flat=True)
queryset = queryset.filter(id__in=watched_ids)
return super().filter_queryset(request, queryset, view) return super().filter_queryset(request, queryset, view)
#####################################################################
# Text search filters
#####################################################################
class QFilter(FilterBackend): class QFilter(FilterBackend):
def filter_queryset(self, request, queryset, view): def filter_queryset(self, request, queryset, view):
q = request.QUERY_PARAMS.get('q', None) q = request.QUERY_PARAMS.get('q', None)
if q: if q:
if q.isdigit(): table = queryset.model._meta.db_table
qs_args = [Q(ref=q)] where_clause = ("to_tsvector('english_nostop', coalesce({table}.subject, '') || ' ' || "
else: "coalesce({table}.ref) || ' ' || "
qs_args = [Q(subject__icontains=x) for x in q.split()] "coalesce({table}.description, '')) @@ to_tsquery('english_nostop', %s)".format(table=table))
queryset = queryset.filter(reduce(operator.and_, qs_args)) queryset = queryset.extra(where=[where_clause], params=[to_tsquery(q)])
return queryset return queryset

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

42
taiga/base/mails.py Normal file
View File

@ -0,0 +1,42 @@
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
from djmail import template_mail
import premailer
import logging
# Hide CSS warnings messages if debug mode is disable
if not getattr(settings, "DEBUG", False):
premailer.premailer.cssutils.log.setLevel(logging.CRITICAL)
class InlineCSSTemplateMail(template_mail.TemplateMail):
def _render_message_body_as_html(self, context):
html = super()._render_message_body_as_html(context)
# Transform CSS into line style attributes
return premailer.transform(html)
class MagicMailBuilder(template_mail.MagicMailBuilder):
pass
mail_builder = MagicMailBuilder(template_mail_cls=InlineCSSTemplateMail)

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -22,7 +22,7 @@ from django.db.models.loading import get_model
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
from djmail.template_mail import MagicMailBuilder, InlineCSSTemplateMail from taiga.base.mails import mail_builder
from taiga.projects.models import Project, Membership from taiga.projects.models import Project, Membership
from taiga.projects.history.models import HistoryEntry from taiga.projects.history.models import HistoryEntry
@ -47,11 +47,12 @@ class Command(BaseCommand):
locale = options.get('locale') locale = options.get('locale')
test_email = args[0] test_email = args[0]
mbuilder = MagicMailBuilder(template_mail_cls=InlineCSSTemplateMail)
# Register email # Register email
context = {"lang": locale, "user": User.objects.all().order_by("?").first(), "cancel_token": "cancel-token"} context = {"lang": locale,
email = mbuilder.registered_user(test_email, context) "user": User.objects.all().order_by("?").first(),
"cancel_token": "cancel-token"}
email = mail_builder.registered_user(test_email, context)
email.send() email.send()
# Membership invitation # Membership invitation
@ -60,12 +61,13 @@ class Command(BaseCommand):
membership.invitation_extra_text = "Text example, Text example,\nText example,\n\nText example" membership.invitation_extra_text = "Text example, Text example,\nText example,\n\nText example"
context = {"lang": locale, "membership": membership} context = {"lang": locale, "membership": membership}
email = mbuilder.membership_invitation(test_email, context) email = mail_builder.membership_invitation(test_email, context)
email.send() email.send()
# Membership notification # Membership notification
context = {"lang": locale, "membership": Membership.objects.order_by("?").filter(user__isnull=False).first()} context = {"lang": locale,
email = mbuilder.membership_notification(test_email, context) "membership": Membership.objects.order_by("?").filter(user__isnull=False).first()}
email = mail_builder.membership_notification(test_email, context)
email.send() email.send()
# Feedback # Feedback
@ -81,17 +83,17 @@ class Command(BaseCommand):
"key2": "value2", "key2": "value2",
}, },
} }
email = mbuilder.feedback_notification(test_email, context) email = mail_builder.feedback_notification(test_email, context)
email.send() email.send()
# Password recovery # Password recovery
context = {"lang": locale, "user": User.objects.all().order_by("?").first()} context = {"lang": locale, "user": User.objects.all().order_by("?").first()}
email = mbuilder.password_recovery(test_email, context) email = mail_builder.password_recovery(test_email, context)
email.send() email.send()
# Change email # Change email
context = {"lang": locale, "user": User.objects.all().order_by("?").first()} context = {"lang": locale, "user": User.objects.all().order_by("?").first()}
email = mbuilder.change_email(test_email, context) email = mail_builder.change_email(test_email, context)
email.send() email.send()
# Export/Import emails # Export/Import emails
@ -102,7 +104,7 @@ class Command(BaseCommand):
"error_subject": "Error generating project dump", "error_subject": "Error generating project dump",
"error_message": "Error generating project dump", "error_message": "Error generating project dump",
} }
email = mbuilder.export_error(test_email, context) email = mail_builder.export_error(test_email, context)
email.send() email.send()
context = { context = {
"lang": locale, "lang": locale,
@ -110,7 +112,7 @@ class Command(BaseCommand):
"error_subject": "Error importing project dump", "error_subject": "Error importing project dump",
"error_message": "Error importing project dump", "error_message": "Error importing project dump",
} }
email = mbuilder.import_error(test_email, context) email = mail_builder.import_error(test_email, context)
email.send() email.send()
deletion_date = timezone.now() + datetime.timedelta(seconds=60*60*24) deletion_date = timezone.now() + datetime.timedelta(seconds=60*60*24)
@ -121,7 +123,7 @@ class Command(BaseCommand):
"project": Project.objects.all().order_by("?").first(), "project": Project.objects.all().order_by("?").first(),
"deletion_date": deletion_date, "deletion_date": deletion_date,
} }
email = mbuilder.dump_project(test_email, context) email = mail_builder.dump_project(test_email, context)
email.send() email.send()
context = { context = {
@ -129,7 +131,7 @@ class Command(BaseCommand):
"user": User.objects.all().order_by("?").first(), "user": User.objects.all().order_by("?").first(),
"project": Project.objects.all().order_by("?").first(), "project": Project.objects.all().order_by("?").first(),
} }
email = mbuilder.load_dump(test_email, context) email = mail_builder.load_dump(test_email, context)
email.send() email.send()
# Notification emails # Notification emails

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django import http from django import http
from django.conf import settings
COORS_ALLOWED_ORIGINS = "*" COORS_ALLOWED_ORIGINS = "*"
@ -28,13 +29,15 @@ COORS_EXPOSE_HEADERS = ["x-pagination-count", "x-paginated", "x-paginated-by",
"x-pagination-current", "x-pagination-next", "x-pagination-prev", "x-pagination-current", "x-pagination-next", "x-pagination-prev",
"x-site-host", "x-site-register"] "x-site-host", "x-site-register"]
COORS_EXTRA_EXPOSE_HEADERS = getattr(settings, "APP_EXTRA_EXPOSE_HEADERS", [])
class CoorsMiddleware(object): class CoorsMiddleware(object):
def _populate_response(self, response): def _populate_response(self, response):
response["Access-Control-Allow-Origin"] = COORS_ALLOWED_ORIGINS response["Access-Control-Allow-Origin"] = COORS_ALLOWED_ORIGINS
response["Access-Control-Allow-Methods"] = ",".join(COORS_ALLOWED_METHODS) response["Access-Control-Allow-Methods"] = ",".join(COORS_ALLOWED_METHODS)
response["Access-Control-Allow-Headers"] = ",".join(COORS_ALLOWED_HEADERS) response["Access-Control-Allow-Headers"] = ",".join(COORS_ALLOWED_HEADERS)
response["Access-Control-Expose-Headers"] = ",".join(COORS_EXPOSE_HEADERS) response["Access-Control-Expose-Headers"] = ",".join(COORS_EXPOSE_HEADERS + COORS_EXTRA_EXPOSE_HEADERS)
response["Access-Control-Max-Age"] = "3600" response["Access-Control-Max-Age"] = "3600"
if COORS_ALLOWED_CREDENTIALS: if COORS_ALLOWED_CREDENTIALS:

View File

@ -1,7 +1,7 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -43,7 +43,7 @@ def get_neighbors(obj, results_set=None):
query = """ query = """
SELECT * FROM SELECT * FROM
(SELECT "id" as id, ROW_NUMBER() OVER() (SELECT "col1" as id, ROW_NUMBER() OVER()
FROM (%s) as ID_AND_ROW) FROM (%s) as ID_AND_ROW)
AS SELECTED_ID_AND_ROW AS SELECTED_ID_AND_ROW
""" % (base_sql) """ % (base_sql)

View File

@ -1,7 +1,7 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2015 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2015 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -0,0 +1,23 @@
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.apps import apps
from django.contrib.contenttypes.management import update_contenttypes
def update_all_contenttypes(**kwargs):
for app_config in apps.get_app_configs():
update_contenttypes(app_config, **kwargs)

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -16,10 +16,28 @@
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import transaction from django.db import transaction
from django.shortcuts import _get_queryset
from . import functions from . import functions
def get_object_or_none(klass, *args, **kwargs):
"""
Uses get() to return an object, or None if the object does not exist.
klass may be a Model, Manager, or QuerySet object. All other passed
arguments and keyword arguments are used in the get() query.
Note: Like with get(), an MultipleObjectsReturned will be raised if more
than one object is found.
"""
queryset = _get_queryset(klass)
try:
return queryset.get(*args, **kwargs)
except queryset.model.DoesNotExist:
return None
def get_typename_for_model_class(model:object, for_concrete_model=True) -> str: def get_typename_for_model_class(model:object, for_concrete_model=True) -> str:
""" """
Get typename for model instance. Get typename for model instance.
@ -107,3 +125,9 @@ def update_in_bulk_with_ids(ids, list_of_new_values, model):
""" """
for id, new_values in zip(ids, list_of_new_values): for id, new_values in zip(ids, list_of_new_values):
model.objects.filter(id=id).update(**new_values) model.objects.filter(id=id).update(**new_values)
def to_tsquery(text):
# We want to transform a query like "exam proj" (should find "project example") to something like proj:* & exam:*
search_elems = ["{}:*".format(search_elem) for search_elem in text.split(" ")]
return " & ".join(search_elems)

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,7 +1,7 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me> # Copyright (C) 2014-2015 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,4 +1,4 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,4 +1,4 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,4 +1,4 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,4 +1,4 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,4 +1,4 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the # published by the Free Software Foundation, either version 3 of the
@ -27,6 +27,8 @@ from . import events
def on_save_any_model(sender, instance, created, **kwargs): def on_save_any_model(sender, instance, created, **kwargs):
# Ignore any object that can not have project_id # Ignore any object that can not have project_id
if not hasattr(instance, "project_id"):
return
content_type = get_typename_for_model_instance(instance) content_type = get_typename_for_model_instance(instance)
# Ignore any other events # Ignore any other events

Some files were not shown because too many files have changed in this diff Show More