From: Guillaume Pellerin Date: Tue, 4 Apr 2017 15:21:42 +0000 (+0200) Subject: Complete package refactoring to make mezzanine-organization a standalone module X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c899d2cc76766d7521e04f343c944aa463065339;p=mezzo.git Complete package refactoring to make mezzanine-organization a standalone module --- diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 52474432..00000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory" : "app/themes/base/static/vendors" -} diff --git a/.gitmodules b/.gitmodules index 0500f447..28ac9302 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "lib/mezzanine"] path = lib/mezzanine url = https://github.com/yomguy/mezzanine.git -[submodule "var"] - path = var - url = git+ssh://git@git.forge.ircam.fr/manifeste-2017-data.git diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index dacda1e1..00000000 --- a/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM python:3 - -ENV PYTHONUNBUFFERED 1 - -RUN mkdir /srv/app -RUN mkdir /srv/lib -WORKDIR /srv - -RUN apt-get update && apt-get install -y apt-transport-https -COPY etc/apt/sources.list /etc/apt/ -COPY requirements-debian.txt /srv -RUN apt-get update && \ - DEBIAN_PACKAGES=$(egrep -v "^\s*(#|$)" /srv/requirements-debian.txt) && \ - apt-get install -y --force-yes $DEBIAN_PACKAGES && \ - echo fr_FR.UTF-8 UTF-8 >> /etc/locale.gen && \ - locale-gen && \ - apt-get clean - -ENV LANG fr_FR.UTF-8 -ENV LANGUAGE fr_FR:fr -ENV LC_ALL fr_FR.UTF-8 - -COPY package.json /srv -RUN npm install - -COPY Gemfile /srv -RUN gem install bundler -RUN bundle install - -COPY bower.json /srv -COPY .bowerrc /srv -RUN npm install -g bower -RUN bower --allow-root install - -COPY gulpfile.js /srv -RUN npm install -g gulp -RUN gulp build - -COPY requirements.txt /srv -RUN pip install -r requirements.txt - -COPY requirements-dev.txt /srv -RUN pip install -r requirements-dev.txt --src /srv/lib - -WORKDIR /srv/app diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 039d053a..00000000 --- a/Gemfile +++ /dev/null @@ -1,4 +0,0 @@ -source "https://rubygems.org" -ruby "2.1.5" -gem "compass", "<= 1.0.3" -gem "sass", "<= 3.4.22" diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 00000000..5e7b7f65 --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,35 @@ +FROM python:3 + +ENV PYTHONUNBUFFERED 1 + +RUN mkdir /srv/app +RUN mkdir /srv/lib +WORKDIR /srv + +RUN apt-get update && apt-get install -y apt-transport-https +COPY ../etc/apt/sources.list /etc/apt/ +COPY ../requirements.txt /srv +RUN apt-get update && \ + DEBIAN_PACKAGES=$(egrep -v "^\s*(#|$)" /srv/requirements.txt) && \ + apt-get install -y --force-yes $DEBIAN_PACKAGES && \ + echo fr_FR.UTF-8 UTF-8 >> /etc/locale.gen && \ + locale-gen && \ + apt-get clean + +ENV LANG fr_FR.UTF-8 +ENV LANGUAGE fr_FR:fr +ENV LC_ALL fr_FR.UTF-8 + +COPY package.json /srv +RUN npm install +RUN npm install -g gulp +RUN npm install -g bower + +COPY Gemfile /srv +RUN gem install bundler +RUN bundle install + +COPY requirements.txt /srv +RUN pip install -r requirements.txt --src /srv/lib + +WORKDIR /srv/app diff --git a/app/Gemfile b/app/Gemfile new file mode 100644 index 00000000..039d053a --- /dev/null +++ b/app/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" +ruby "2.1.5" +gem "compass", "<= 1.0.3" +gem "sass", "<= 3.4.22" diff --git a/app/organization/__init__.py b/app/organization/__init__.py deleted file mode 100644 index 1c09a839..00000000 --- a/app/organization/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - - -__version__ = 1.0 diff --git a/app/organization/agenda/__init__.py b/app/organization/agenda/__init__.py deleted file mode 100644 index 1ad370fd..00000000 --- a/app/organization/agenda/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -""" -Provides abstract models and admin features used throughout the various -Mezzanine apps. -""" -from __future__ import unicode_literals - -default_app_config = 'organization.agenda.apps.AgendaConfig' diff --git a/app/organization/agenda/admin.py b/app/organization/agenda/admin.py deleted file mode 100644 index ad6d5653..00000000 --- a/app/organization/agenda/admin.py +++ /dev/null @@ -1,145 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from __future__ import unicode_literals - -from copy import deepcopy - -from django.contrib import admin -from django.utils.translation import ugettext_lazy as _ -from modeltranslation.admin import TranslationTabularInline -from mezzanine.core.admin import * -from mezzanine.pages.admin import PageAdmin -from mezzanine.conf import settings -from mezzanine.core.admin import DisplayableAdmin, OwnableAdmin -from mezzanine_agenda.models import Event, EventCategory -from mezzanine_agenda.admin import * -from organization.core.models import * -from organization.agenda.models import * -from organization.agenda.forms import * - - -class EventBlockInline(StackedDynamicInlineAdmin): - - model = EventBlock - - -class EventImageInline(TabularDynamicInlineAdmin): - - model = EventImage - - -class EventPlaylistInline(TabularDynamicInlineAdmin): - - model = EventPlaylist - - -class EventDepartmentInline(TabularDynamicInlineAdmin): - - model = EventDepartment - - -class EventPersonInline(TabularDynamicInlineAdmin): - - model = EventPerson - - -class EventLinkInline(TabularDynamicInlineAdmin): - - model = EventLink - - -class EventTrainingInline(StackedDynamicInlineAdmin): - - model = EventTraining - - -class EventPeriodInline(TabularDynamicInlineAdmin): - - model = EventPeriod - - -class EventRelatedTitleAdmin(TranslationTabularInline): - - model = EventRelatedTitle - - -class EventPriceDescriptionAdmin(TranslationTabularInline): - - model = EventPriceDescription - - -class CustomEventPriceAdmin(BaseTranslationModelAdmin): - - inlines = [EventPriceDescriptionAdmin,] - - -class DynamicContentEventInline(TabularDynamicInlineAdmin): - - model = DynamicContentEvent - form = DynamicContentEventForm - - class Media: - js = ( - static("mezzanine/js/admin/dynamic_inline.js"), - ) - - -class CustomEventAdmin(EventAdmin): - """ - Admin class for events. - """ - - fieldsets = deepcopy(EventAdminBase.fieldsets) - exclude = ("short_url", ) - list_display = ["title", "start", "end", "rank", "user", "status", "admin_link"] - if settings.EVENT_USE_FEATURED_IMAGE: - list_display.insert(0, "admin_thumb") - list_filter = deepcopy(DisplayableAdmin.list_filter) + ("location", "category") - inlines = [EventPeriodInline, EventBlockInline, EventImageInline, EventDepartmentInline, - EventPersonInline, EventLinkInline, EventPlaylistInline, EventTrainingInline, - EventRelatedTitleAdmin, DynamicContentEventInline] - - -class CustomEventCategoryAdmin(BaseTranslationModelAdmin): - - pass - - -class EventPublicTypeAdmin(BaseTranslationModelAdmin): - - model = EventPublicType - - -class EventTrainingLevelAdmin(BaseTranslationModelAdmin): - - model = EventTrainingLevel - - - -admin.site.unregister(Event) -admin.site.unregister(EventPrice) -admin.site.unregister(EventCategory) -admin.site.register(EventPublicType, EventPublicTypeAdmin) -admin.site.register(EventTrainingLevel, EventTrainingLevelAdmin) -admin.site.register(Event, CustomEventAdmin) -admin.site.register(EventCategory, CustomEventCategoryAdmin) -admin.site.register(EventPrice, CustomEventPriceAdmin) diff --git a/app/organization/agenda/apps.py b/app/organization/agenda/apps.py deleted file mode 100644 index 00a5653f..00000000 --- a/app/organization/agenda/apps.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.apps import AppConfig - -from django.core.checks import register - - -class AgendaConfig(AppConfig): - - name = 'organization.agenda' - label = 'organization-agenda' diff --git a/app/organization/agenda/forms.py b/app/organization/agenda/forms.py deleted file mode 100644 index 882bf277..00000000 --- a/app/organization/agenda/forms.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from dal import autocomplete - -import dal_queryset_sequence -import dal_select2_queryset_sequence - -from django import forms -from django.forms.widgets import HiddenInput -from django.forms import ModelForm -from mezzanine.core.models import Orderable -from organization.magazine.models import Article, Topic, Brief -from organization.pages.models import CustomPage -from organization.agenda.models import Event, DynamicContentEvent -from organization.media.models import Playlist - -class DynamicContentEventForm(autocomplete.FutureModelForm): - - content_object = dal_queryset_sequence.fields.QuerySetSequenceModelField( - queryset=autocomplete.QuerySetSequence( - Article.objects.all(), - CustomPage.objects.all(), - Event.objects.all() - ), - required=False, - widget=dal_select2_queryset_sequence.widgets.QuerySetSequenceSelect2('dynamic-content-event'), - ) - - class Meta: - model = DynamicContentEvent - fields = ('content_object',) diff --git a/app/organization/agenda/management/__init__.py b/app/organization/agenda/management/__init__.py deleted file mode 100644 index 12176181..00000000 --- a/app/organization/agenda/management/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - diff --git a/app/organization/agenda/management/commands/__init__.py b/app/organization/agenda/management/commands/__init__.py deleted file mode 100644 index 12176181..00000000 --- a/app/organization/agenda/management/commands/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - diff --git a/app/organization/agenda/management/commands/organization-sync-eve-events.py b/app/organization/agenda/management/commands/organization-sync-eve-events.py deleted file mode 100644 index 83342da7..00000000 --- a/app/organization/agenda/management/commands/organization-sync-eve-events.py +++ /dev/null @@ -1,119 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from datetime import datetime, timedelta -from optparse import make_option - -from django.conf import settings -from django.core.management.base import BaseCommand, CommandError -from django.contrib.auth.models import User -from django.core.mail import EmailMessage - -import mezzanine_agenda.models as ma_models -from mezzanine.generic.models import AssignedKeyword, Keyword - -import eve.models as eve_models -import organization.agenda - -class Command(BaseCommand): - """Synchronize events from E-vement to mezzanine_agenda""" - - - option_list = BaseCommand.option_list + ( - make_option('-m', '--meta_event', - dest='meta_event', - help='define eve meta_event'), - ) - - default_user = User.objects.get(username='admin') - - def cleanup(self): - for event in ma_models.Event.objects.all(): - event.delete() - for location in ma_models.EventLocation.objects.all(): - location.delete() - for event_price in ma_models.EventPrice.objects.all(): - event_price.delete() - for period in organization.agenda.models.EventPeriod.objects.all(): - period.delete() - - def handle(self, *args, **kwargs): - self.cleanup() - - meta_event_name = kwargs.get('meta_event') - meta_trans_all = eve_models.MetaEventTranslation.objects.all() - for meta_trans in meta_trans_all: - if meta_trans.name == meta_event_name: - break - - eve_events = eve_models.Event.objects.filter(meta_event=meta_trans.id) - - for eve_event in eve_events: - first = True - eve_locations = [] - event_trans = eve_models.EventTranslation.objects.filter(id=eve_event, lang='fr')[0] - event_trans_en = eve_models.EventTranslation.objects.filter(id=eve_event, lang='en')[0] - manifestations = eve_event.manifestations.all().order_by('happens_at') - events = ma_models.Event.objects.filter(external_id=eve_event.id) - - if not events: - event = ma_models.Event(external_id=eve_event.id) - else: - event = events[0] - - for manifestation in manifestations: - if first: - event.title = event_trans.name - event.title_en = event_trans_en.name - event.user = self.default_user - locations = ma_models.EventLocation.objects.filter(title=manifestation.location.name) - if locations: - location = locations[0] - else: - location = ma_models.EventLocation(title=manifestation.location.name) - address = '\n'.join([manifestation.location.address, manifestation.location.postalcode + ' ' + manifestation.location.city]) - location.address = address - location.external_id = manifestation.id - location.clean() - location.save() - event.location = location - event.start = manifestation.happens_at - event.save() - first = False - - period = organization.agenda.models.EventPeriod(event=event) - period.date_from = manifestation.happens_at - period.date_to = manifestation.happens_at + timedelta(seconds=manifestation.duration) - period.save() - - # keyword, c = Keyword.objects.get_or_create(title=eve_event.event_category.name) - # event.keywords.add(AssignedKeyword(keyword=keyword), bulk=False) - - eve_prices = eve_models.PriceManifestation.objects.filter(manifestation=manifestation) - for price in eve_prices: - event_price, c = ma_models.EventPrice.objects.get_or_create(value=float(price.value)) - if event: - if not event_price in event.prices.all(): - event.prices.add(event_price) - - event.end = period.date_to - event.status = 1 - event.save() diff --git a/app/organization/agenda/management/commands/organization-sync-prestashop-events.py b/app/organization/agenda/management/commands/organization-sync-prestashop-events.py deleted file mode 100644 index d0a3cf0b..00000000 --- a/app/organization/agenda/management/commands/organization-sync-prestashop-events.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from datetime import datetime, timedelta -from optparse import make_option - -from django.conf import settings -from django.core.management.base import BaseCommand, CommandError -from django.contrib.auth.models import User -from django.core.mail import EmailMessage - -from mezzanine.generic.models import AssignedKeyword, Keyword - -import mezzanine_agenda.models as ma_models -import organization.agenda.models as oa_models -import prestashop.models as pa_models -import cartridge.shop.models as ca_models - - -class Command(BaseCommand): - """Synchronize events from PrestaShop to mezzanine_agenda""" - - - option_list = BaseCommand.option_list + ( - make_option('-c', '--category', - dest='category_lang_name', - help='define prestashop PsCategoryLang'), - ) - - default_user = User.objects.get(username='admin') - languages = { 1 : {'code': 'en', 'names': ['english', 'anglais']}, - 2 : {'code': 'fr', 'names': ['french', 'français']},} - - - def cleanup(self): - for event in ma_models.Event.objects.all(): - event.delete() - - def handle(self, *args, **kwargs): - # !! NOT FOR PROD !! - # self.cleanup() - - products = [] - category_lang_name = kwargs.get('category_lang_name') - - if not category_lang_name: - for category in pa_models.PsCategoryLang.objects.all(): - print(category.name) - - category_lang_name = kwargs.get('category_lang_name') - category_lang = pa_models.PsCategoryLang.objects.get(name=category_lang_name) - category = pa_models.PsCategory.objects.get(id_category=category_lang.id_category) - category_products = pa_models.PsCategoryProduct.objects.filter(id_category=category.id_category) - - for category_product in category_products: - products.append(pa_models.PsProduct.objects.get(id_product=category_product.id_product)) - - for product in products: - print('---------------------------') - print(product.id_product) - - events = ma_models.Event.objects.filter(external_id=product.id_product) - if events: - event = events[0] - else: - event = ma_models.Event(external_id=product.id_product) - - product_langs = pa_models.PsProductLang.objects.filter(id_product=product.id_product) - for product_lang in product_langs: - lang_code = self.languages[product_lang.id_lang]['code'] - - for lang in self.languages: - if product_lang.teaching_lang.lower() in self.languages[product_lang.id_lang]['names']: - language = self.languages[product_lang.id_lang]['code'] - event_training = oa_models.EventTraining(language=language) - break - - print(product_lang.name, lang_code, product_lang.dates) - - setattr(event, 'title' + '_' + lang_code, product_lang.name) - setattr(event, 'content' + '_' + lang_code, product_lang.description) - event.date_text = product_lang.dates - - event.start = datetime.now() - event.user = self.default_user - event_price, c = ma_models.EventPrice.objects.get_or_create(value=product.price) - event.save() - event.prices.add(event_price) - event.status = 1 - event.save() - event_training.event = event - event_training.save() diff --git a/app/organization/agenda/migrations/0001_initial.py b/app/organization/agenda/migrations/0001_initial.py deleted file mode 100644 index 0fb3c043..00000000 --- a/app/organization/agenda/migrations/0001_initial.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-01 15:24 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion -import mezzanine.core.fields - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('mezzanine_agenda', '0003_remove_event_blog_posts'), - ] - - operations = [ - migrations.CreateModel( - name='EventBlock', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('content', mezzanine.core.fields.RichTextField(verbose_name='Content')), - ('_order', mezzanine.core.fields.OrderField(null=True, verbose_name='Order')), - ('title', models.CharField(max_length=1024, verbose_name='title')), - ('description', models.TextField(blank=True, verbose_name='description')), - ('with_separator', models.BooleanField(default=False)), - ('background_color', models.CharField(blank=True, choices=[('black', 'black'), ('yellow', 'yellow'), ('red', 'red')], max_length=32, verbose_name='background color')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='blocks', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'ordering': ('_order',), - 'verbose_name_plural': 'blocks', - 'verbose_name': 'block', - }, - ), - migrations.CreateModel( - name='EventImage', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('_order', mezzanine.core.fields.OrderField(null=True, verbose_name='Order')), - ('title', models.CharField(max_length=1024, verbose_name='title')), - ('description', models.TextField(blank=True, verbose_name='description')), - ('file', mezzanine.core.fields.FileField(max_length=1024, verbose_name='Image')), - ('credits', models.CharField(blank=True, max_length=256, null=True, verbose_name='credits')), - ('type', models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page slider')], max_length=64, verbose_name='type')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='images', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'ordering': ('_order',), - 'verbose_name_plural': 'images', - 'verbose_name': 'image', - }, - ), - ] diff --git a/app/organization/agenda/migrations/0002_eventdepartment.py b/app/organization/agenda/migrations/0002_eventdepartment.py deleted file mode 100644 index 14eb8a81..00000000 --- a/app/organization/agenda/migrations/0002_eventdepartment.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-07 13:41 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-network', '0005_auto_20160905_1853'), - ('mezzanine_agenda', '0005_auto_20160907_1541'), - ('organization-agenda', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='EventDepartment', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='organization-network.Department', verbose_name='department')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='departments', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name_plural': 'departments', - 'verbose_name': 'department', - }, - ), - ] diff --git a/app/organization/agenda/migrations/0003_eventlink_eventperson.py b/app/organization/agenda/migrations/0003_eventlink_eventperson.py deleted file mode 100644 index 35dde9bd..00000000 --- a/app/organization/agenda/migrations/0003_eventlink_eventperson.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-23 14:34 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('mezzanine_agenda', '0007_auto_20160923_1634'), - ('organization-core', '0004_auto_20160923_1141'), - ('organization-network', '0023_auto_20160921_2043'), - ('organization-agenda', '0002_eventdepartment'), - ] - - operations = [ - migrations.CreateModel( - name='EventLink', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('url', models.URLField(blank=True, max_length=512, verbose_name='URL')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='links', to='mezzanine_agenda.Event', verbose_name='event')), - ('link_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organization-core.LinkType', verbose_name='link type')), - ], - options={ - 'verbose_name_plural': 'links', - 'verbose_name': 'link', - }, - ), - migrations.CreateModel( - name='EventPerson', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='persons', to='mezzanine_agenda.Event', verbose_name='event')), - ('person', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='organization-network.Person', verbose_name='person')), - ], - options={ - 'verbose_name_plural': 'persons', - 'verbose_name': 'person', - }, - ), - ] diff --git a/app/organization/agenda/migrations/0004_eventaudio_eventvideo.py b/app/organization/agenda/migrations/0004_eventaudio_eventvideo.py deleted file mode 100644 index 6983d766..00000000 --- a/app/organization/agenda/migrations/0004_eventaudio_eventvideo.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-27 14:55 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion -import mezzanine.core.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('mezzanine_agenda', '0008_auto_20160926_1552'), - ('organization-agenda', '0003_eventlink_eventperson'), - ] - - operations = [ - migrations.CreateModel( - name='EventAudio', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('_order', mezzanine.core.fields.OrderField(null=True, verbose_name='Order')), - ('title', models.CharField(max_length=1024, verbose_name='title')), - ('description', models.TextField(blank=True, verbose_name='description')), - ('file', mezzanine.core.fields.FileField(max_length=1024, verbose_name='Image')), - ('credits', models.CharField(blank=True, max_length=256, null=True, verbose_name='credits')), - ('type', models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page slider')], max_length=64, verbose_name='type')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='audios', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name_plural': 'audios', - 'verbose_name': 'audio', - 'ordering': ('_order',), - }, - ), - migrations.CreateModel( - name='EventVideo', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('_order', mezzanine.core.fields.OrderField(null=True, verbose_name='Order')), - ('title', models.CharField(max_length=1024, verbose_name='title')), - ('description', models.TextField(blank=True, verbose_name='description')), - ('file', mezzanine.core.fields.FileField(max_length=1024, verbose_name='Image')), - ('credits', models.CharField(blank=True, max_length=256, null=True, verbose_name='credits')), - ('type', models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page slider')], max_length=64, verbose_name='type')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='videos', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name_plural': 'videos', - 'verbose_name': 'video', - 'ordering': ('_order',), - }, - ), - ] diff --git a/app/organization/agenda/migrations/0005_auto_20160928_1858.py b/app/organization/agenda/migrations/0005_auto_20160928_1858.py deleted file mode 100644 index 2fd170f1..00000000 --- a/app/organization/agenda/migrations/0005_auto_20160928_1858.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-28 16:58 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0004_eventaudio_eventvideo'), - ] - - operations = [ - migrations.AlterField( - model_name='eventaudio', - name='type', - field=models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page - slider'), ('page_featured', 'page - featured')], max_length=64, verbose_name='type'), - ), - migrations.AlterField( - model_name='eventimage', - name='type', - field=models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page - slider'), ('page_featured', 'page - featured')], max_length=64, verbose_name='type'), - ), - migrations.AlterField( - model_name='eventvideo', - name='type', - field=models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page - slider'), ('page_featured', 'page - featured')], max_length=64, verbose_name='type'), - ), - ] diff --git a/app/organization/agenda/migrations/0006_auto_20160929_1257.py b/app/organization/agenda/migrations/0006_auto_20160929_1257.py deleted file mode 100644 index 6fa20ff2..00000000 --- a/app/organization/agenda/migrations/0006_auto_20160929_1257.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-29 10:57 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-media', '0001_initial'), - ('organization-agenda', '0005_auto_20160928_1858'), - ] - - operations = [ - migrations.AlterModelOptions( - name='eventaudio', - options={'verbose_name': 'audio', 'verbose_name_plural': 'audios'}, - ), - migrations.AlterModelOptions( - name='eventvideo', - options={'verbose_name': 'video', 'verbose_name_plural': 'videos'}, - ), - migrations.AddField( - model_name='eventaudio', - name='audio_ptr', - field=models.OneToOneField(auto_created=True, default=1, on_delete=django.db.models.deletion.CASCADE, parent_link=True, serialize=False, to='organization-media.Audio'), - preserve_default=False, - ), - migrations.AddField( - model_name='eventvideo', - name='video_ptr', - field=models.OneToOneField(auto_created=True, default=1, on_delete=django.db.models.deletion.CASCADE, parent_link=True, serialize=False, to='organization-media.Video'), - preserve_default=False, - ), - migrations.RemoveField( - model_name='eventaudio', - name='_order', - ), - migrations.RemoveField( - model_name='eventaudio', - name='credits', - ), - migrations.RemoveField( - model_name='eventaudio', - name='description', - ), - migrations.RemoveField( - model_name='eventaudio', - name='file', - ), - migrations.RemoveField( - model_name='eventaudio', - name='id', - ), - migrations.RemoveField( - model_name='eventaudio', - name='title', - ), - migrations.RemoveField( - model_name='eventaudio', - name='type', - ), - migrations.AlterOrderWithRespectTo( - name='eventaudio', - order_with_respect_to='event', - ), - migrations.RemoveField( - model_name='eventvideo', - name='_order', - ), - migrations.RemoveField( - model_name='eventvideo', - name='credits', - ), - migrations.RemoveField( - model_name='eventvideo', - name='description', - ), - migrations.RemoveField( - model_name='eventvideo', - name='file', - ), - migrations.RemoveField( - model_name='eventvideo', - name='id', - ), - migrations.RemoveField( - model_name='eventvideo', - name='title', - ), - migrations.RemoveField( - model_name='eventvideo', - name='type', - ), - migrations.AlterOrderWithRespectTo( - name='eventvideo', - order_with_respect_to='event', - ), - ] diff --git a/app/organization/agenda/migrations/0007_auto_20160929_1300.py b/app/organization/agenda/migrations/0007_auto_20160929_1300.py deleted file mode 100644 index dfae2d99..00000000 --- a/app/organization/agenda/migrations/0007_auto_20160929_1300.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-29 11:00 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0006_auto_20160929_1257'), - ] - - operations = [ - migrations.AlterField( - model_name='eventaudio', - name='audio_ptr', - field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='organization-media.Audio'), - ), - migrations.AlterField( - model_name='eventvideo', - name='video_ptr', - field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='organization-media.Video'), - ), - ] diff --git a/app/organization/agenda/migrations/0008_auto_20161005_1455.py b/app/organization/agenda/migrations/0008_auto_20161005_1455.py deleted file mode 100644 index a07cdbca..00000000 --- a/app/organization/agenda/migrations/0008_auto_20161005_1455.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-05 12:55 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('mezzanine_agenda', '0010_remove_event_language'), - ('organization-agenda', '0007_auto_20160929_1300'), - ] - - operations = [ - migrations.CreateModel( - name='EventPeriod', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date_from', models.DateTimeField(blank=True, null=True, verbose_name='begin date')), - ('date_to', models.DateTimeField(blank=True, null=True, verbose_name='end date')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='periods', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name_plural': 'periods', - 'verbose_name': 'period', - }, - ), - migrations.CreateModel( - name='EventPublicType', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=512, verbose_name='name')), - ('name_fr', models.CharField(max_length=512, null=True, verbose_name='name')), - ('name_en', models.CharField(max_length=512, null=True, verbose_name='name')), - ('description', models.TextField(blank=True, verbose_name='description')), - ], - options={ - 'verbose_name_plural': 'public types', - 'verbose_name': 'public type', - }, - ), - migrations.CreateModel( - name='EventTraining', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language', models.CharField(blank=True, choices=[('fr', 'French'), ('en', 'English')], max_length=64, null=True, verbose_name='Language')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='trainings', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name_plural': 'trainings', - 'verbose_name': 'training', - }, - ), - migrations.CreateModel( - name='EventTrainingLevel', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=512, verbose_name='name')), - ('name_fr', models.CharField(max_length=512, null=True, verbose_name='name')), - ('name_en', models.CharField(max_length=512, null=True, verbose_name='name')), - ('description', models.TextField(blank=True, verbose_name='description')), - ], - options={ - 'verbose_name_plural': 'training levels', - 'verbose_name': 'training level', - }, - ), - migrations.AddField( - model_name='eventtraining', - name='level', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='trainings', to='organization-agenda.EventTrainingLevel', verbose_name='level'), - ), - migrations.AddField( - model_name='eventtraining', - name='public_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='trainings', to='organization-agenda.EventPublicType', verbose_name='public type'), - ), - ] diff --git a/app/organization/agenda/migrations/0009_auto_20161013_1631.py b/app/organization/agenda/migrations/0009_auto_20161013_1631.py deleted file mode 100644 index d3aa4b02..00000000 --- a/app/organization/agenda/migrations/0009_auto_20161013_1631.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-13 14:31 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-media', '0005_auto_20160930_1849'), - ('mezzanine_agenda', '0013_auto_20161010_1130'), - ('organization-agenda', '0008_auto_20161005_1455'), - ] - - operations = [ - migrations.CreateModel( - name='EventPlaylist', - fields=[ - ('playlist_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='organization-media.Playlist')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='playlists', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name': 'playlist', - 'verbose_name_plural': 'playlists', - }, - bases=('organization-media.playlist',), - ), - migrations.DeleteModel( - name='EventAudio', - ), - migrations.DeleteModel( - name='EventVideo', - ), - migrations.AlterOrderWithRespectTo( - name='eventplaylist', - order_with_respect_to='event', - ), - ] diff --git a/app/organization/agenda/migrations/0010_auto_20161014_0002.py b/app/organization/agenda/migrations/0010_auto_20161014_0002.py deleted file mode 100644 index 4a148aca..00000000 --- a/app/organization/agenda/migrations/0010_auto_20161014_0002.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-13 22:02 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-media', '0009_auto_20161013_2353'), - ('organization-agenda', '0009_auto_20161013_1631'), - ] - - operations = [ - migrations.RemoveField( - model_name='eventplaylist', - name='playlist_ptr', - ), - migrations.AddField( - model_name='eventplaylist', - name='playlistrelated_ptr', - field=models.OneToOneField(auto_created=True, default=1, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='organization-media.PlaylistRelated'), - preserve_default=False, - ), - ] diff --git a/app/organization/agenda/migrations/0011_auto_20161018_1804.py b/app/organization/agenda/migrations/0011_auto_20161018_1804.py deleted file mode 100644 index cb14dd46..00000000 --- a/app/organization/agenda/migrations/0011_auto_20161018_1804.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-18 16:04 -from __future__ import unicode_literals - -from django.db import migrations, models -import mezzanine.core.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0010_auto_20161014_0002'), - ] - - operations = [ - migrations.AddField( - model_name='eventblock', - name='content_en', - field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'), - ), - migrations.AddField( - model_name='eventblock', - name='content_fr', - field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'), - ), - migrations.AddField( - model_name='eventblock', - name='description_en', - field=models.TextField(blank=True, null=True, verbose_name='description'), - ), - migrations.AddField( - model_name='eventblock', - name='description_fr', - field=models.TextField(blank=True, null=True, verbose_name='description'), - ), - migrations.AddField( - model_name='eventblock', - name='title_en', - field=models.CharField(max_length=1024, null=True, verbose_name='title'), - ), - migrations.AddField( - model_name='eventblock', - name='title_fr', - field=models.CharField(max_length=1024, null=True, verbose_name='title'), - ), - ] diff --git a/app/organization/agenda/migrations/0012_auto_20161020_1051.py b/app/organization/agenda/migrations/0012_auto_20161020_1051.py deleted file mode 100644 index a3b4b10e..00000000 --- a/app/organization/agenda/migrations/0012_auto_20161020_1051.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-20 08:51 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0011_auto_20161018_1804'), - ] - - operations = [ - migrations.AlterField( - model_name='eventtraining', - name='language', - field=models.CharField(blank=True, choices=[('fr', 'French'), ('en', 'English')], max_length=64, null=True, verbose_name='language'), - ), - ] diff --git a/app/organization/agenda/migrations/0013_eventlink_title.py b/app/organization/agenda/migrations/0013_eventlink_title.py deleted file mode 100644 index 276cf9de..00000000 --- a/app/organization/agenda/migrations/0013_eventlink_title.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-21 11:06 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0012_auto_20161020_1051'), - ] - - operations = [ - migrations.AddField( - model_name='eventlink', - name='title', - field=models.CharField(default='', max_length=1024, verbose_name='title'), - preserve_default=False, - ), - ] diff --git a/app/organization/agenda/migrations/0014_auto_20161021_1319.py b/app/organization/agenda/migrations/0014_auto_20161021_1319.py deleted file mode 100644 index c2e3c511..00000000 --- a/app/organization/agenda/migrations/0014_auto_20161021_1319.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-21 11:19 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0013_eventlink_title'), - ] - - operations = [ - migrations.AlterField( - model_name='eventlink', - name='title', - field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), - ), - ] diff --git a/app/organization/agenda/migrations/0015_auto_20161026_1025.py b/app/organization/agenda/migrations/0015_auto_20161026_1025.py deleted file mode 100644 index 7d081b36..00000000 --- a/app/organization/agenda/migrations/0015_auto_20161026_1025.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-10-26 08:25 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0014_auto_20161021_1319'), - ] - - operations = [ - migrations.AddField( - model_name='eventlink', - name='title_en', - field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), - ), - migrations.AddField( - model_name='eventlink', - name='title_fr', - field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), - ), - ] diff --git a/app/organization/agenda/migrations/0016_dynamiccontentevent.py b/app/organization/agenda/migrations/0016_dynamiccontentevent.py deleted file mode 100644 index 2dc36a3a..00000000 --- a/app/organization/agenda/migrations/0016_dynamiccontentevent.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-11-04 17:01 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion -import mezzanine.core.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('mezzanine_agenda', '0015_auto_20161021_1937'), - ('organization-agenda', '0015_auto_20161026_1025'), - ] - - operations = [ - migrations.CreateModel( - name='DynamicContentEvent', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('_order', mezzanine.core.fields.OrderField(null=True, verbose_name='Order')), - ('object_id', models.PositiveIntegerField(editable=False, null=True, verbose_name='related object')), - ('content_type', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='content type')), - ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dynamic_content_event', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'ordering': ('_order',), - 'verbose_name': 'Dynamic Content Event', - }, - ), - ] diff --git a/app/organization/agenda/migrations/0017_auto_20161104_1812.py b/app/organization/agenda/migrations/0017_auto_20161104_1812.py deleted file mode 100644 index 57ee7f58..00000000 --- a/app/organization/agenda/migrations/0017_auto_20161104_1812.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-11-04 17:12 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('mezzanine_agenda', '0015_auto_20161021_1937'), - ('organization-agenda', '0016_dynamiccontentevent'), - ] - - operations = [ - migrations.CreateModel( - name='EventRelatedTitle', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(blank=True, max_length=1024, null=True, verbose_name='title')), - ('event', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='related_title', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name': 'related title', - }, - ), - migrations.AlterOrderWithRespectTo( - name='eventrelatedtitle', - order_with_respect_to='event', - ), - ] diff --git a/app/organization/agenda/migrations/0018_auto_20161104_1820.py b/app/organization/agenda/migrations/0018_auto_20161104_1820.py deleted file mode 100644 index 560b7dc9..00000000 --- a/app/organization/agenda/migrations/0018_auto_20161104_1820.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-11-04 17:20 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0017_auto_20161104_1812'), - ] - - operations = [ - migrations.AddField( - model_name='eventrelatedtitle', - name='title_en', - field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), - ), - migrations.AddField( - model_name='eventrelatedtitle', - name='title_fr', - field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), - ), - ] diff --git a/app/organization/agenda/migrations/0019_eventpricedescription.py b/app/organization/agenda/migrations/0019_eventpricedescription.py deleted file mode 100644 index d31808f1..00000000 --- a/app/organization/agenda/migrations/0019_eventpricedescription.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-11-07 15:14 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('mezzanine_agenda', '0015_auto_20161021_1937'), - ('organization-agenda', '0018_auto_20161104_1820'), - ] - - operations = [ - migrations.CreateModel( - name='EventPriceDescription', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('description', models.TextField(blank=True, null=True, verbose_name='description')), - ('description_fr', models.TextField(blank=True, null=True, verbose_name='description')), - ('description_en', models.TextField(blank=True, null=True, verbose_name='description')), - ('event_price', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='event_price_description', to='mezzanine_agenda.EventPrice', verbose_name='event_price_description')), - ], - options={ - 'verbose_name': 'Additionnal description', - }, - ), - ] diff --git a/app/organization/agenda/migrations/0020_auto_20161205_1536.py b/app/organization/agenda/migrations/0020_auto_20161205_1536.py deleted file mode 100644 index 5b2b116f..00000000 --- a/app/organization/agenda/migrations/0020_auto_20161205_1536.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2016-12-05 14:36 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0019_eventpricedescription'), - ] - - operations = [ - migrations.AlterField( - model_name='eventimage', - name='type', - field=models.CharField(choices=[('logo', 'logo'), ('logo_white', 'logo white'), ('logo_black', 'logo black'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page - slider'), ('page_featured', 'page - featured')], max_length=64, verbose_name='type'), - ), - ] diff --git a/app/organization/agenda/migrations/0021_eventblock_login_required.py b/app/organization/agenda/migrations/0021_eventblock_login_required.py deleted file mode 100644 index b74c3cac..00000000 --- a/app/organization/agenda/migrations/0021_eventblock_login_required.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-01-03 11:20 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0020_auto_20161205_1536'), - ] - - operations = [ - migrations.AddField( - model_name='eventblock', - name='login_required', - field=models.BooleanField(default=False, verbose_name='login required'), - ), - ] diff --git a/app/organization/agenda/migrations/0022_auto_20170105_1743.py b/app/organization/agenda/migrations/0022_auto_20170105_1743.py deleted file mode 100644 index 930c9aec..00000000 --- a/app/organization/agenda/migrations/0022_auto_20170105_1743.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-01-05 16:43 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0021_eventblock_login_required'), - ] - - operations = [ - migrations.AlterField( - model_name='eventimage', - name='type', - field=models.CharField(choices=[('logo', 'logo'), ('logo_white', 'logo white'), ('logo_black', 'logo black'), ('logo_header', 'logo header'), ('logo_footer', 'logo footer'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page - slider'), ('page_featured', 'page - featured')], max_length=64, verbose_name='type'), - ), - ] diff --git a/app/organization/agenda/migrations/0023_auto_20170214_1643.py b/app/organization/agenda/migrations/0023_auto_20170214_1643.py deleted file mode 100644 index a6d3ed01..00000000 --- a/app/organization/agenda/migrations/0023_auto_20170214_1643.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-02-14 15:43 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0022_auto_20170105_1743'), - ] - - operations = [ - migrations.AlterField( - model_name='eventblock', - name='background_color', - field=models.CharField(blank=True, choices=[('black', 'black'), ('yellow', 'yellow'), ('red', 'red'), ('white', 'white')], max_length=32, verbose_name='background color'), - ), - ] diff --git a/app/organization/agenda/migrations/0024_eventrank.py b/app/organization/agenda/migrations/0024_eventrank.py deleted file mode 100644 index 036263fd..00000000 --- a/app/organization/agenda/migrations/0024_eventrank.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-02-21 14:44 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('mezzanine_agenda', '0016_auto_20161216_1558'), - ('organization-agenda', '0023_auto_20170214_1643'), - ] - - operations = [ - migrations.CreateModel( - name='EventRank', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rank', models.IntegerField(blank=True, null=True, verbose_name='rank')), - ('event', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='event_rank', to='mezzanine_agenda.Event', verbose_name='event')), - ], - options={ - 'verbose_name_plural': 'ranks', - 'verbose_name': 'rank', - }, - ), - ] diff --git a/app/organization/agenda/migrations/0025_auto_20170222_1011.py b/app/organization/agenda/migrations/0025_auto_20170222_1011.py deleted file mode 100644 index 4998e636..00000000 --- a/app/organization/agenda/migrations/0025_auto_20170222_1011.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-02-22 09:11 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0024_eventrank'), - ] - - operations = [ - migrations.RemoveField( - model_name='eventrank', - name='event', - ), - migrations.DeleteModel( - name='EventRank', - ), - ] diff --git a/app/organization/agenda/migrations/0026_auto_20170313_1224.py b/app/organization/agenda/migrations/0026_auto_20170313_1224.py deleted file mode 100644 index fbf75f8a..00000000 --- a/app/organization/agenda/migrations/0026_auto_20170313_1224.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-03-13 11:24 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-agenda', '0025_auto_20170222_1011'), - ] - - operations = [ - migrations.AlterField( - model_name='eventtraining', - name='language', - field=models.CharField(blank=True, choices=[('en', 'English'), ('fr', 'French')], max_length=64, null=True, verbose_name='language'), - ), - ] diff --git a/app/organization/agenda/migrations/__init__.py b/app/organization/agenda/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/app/organization/agenda/models.py b/app/organization/agenda/models.py deleted file mode 100644 index cfd9523f..00000000 --- a/app/organization/agenda/models.py +++ /dev/null @@ -1,150 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from __future__ import unicode_literals -from future.builtins import str - -from django.utils.translation import ugettext_lazy as _ -from mezzanine.core.models import Orderable -from mezzanine.conf import settings -from mezzanine_agenda.models import * -from organization.core.models import * -from organization.network.models import * - - - -class EventBlock(Block): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='blocks', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("block") - verbose_name_plural = _("blocks") - - -class EventImage(Image): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='images', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("image") - verbose_name_plural = _("images") - order_with_respect_to = "event" - - -class EventDepartment(models.Model): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='departments', blank=True, null=True, on_delete=models.SET_NULL) - department = models.ForeignKey(Department, verbose_name=_('department'), related_name='events', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("department") - verbose_name_plural = _("departments") - - -class EventPerson(models.Model): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='persons', blank=True, null=True, on_delete=models.SET_NULL) - person = models.ForeignKey(Person, verbose_name=_('person'), related_name='events', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("person") - verbose_name_plural = _("persons") - - -class EventLink(Link): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='links', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("link") - verbose_name_plural = _("links") - - -class EventPlaylist(PlaylistRelated): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='playlists', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("playlist") - verbose_name_plural = _("playlists") - order_with_respect_to = "event" - - -class EventPeriod(PeriodDateTime): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='periods', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("period") - verbose_name_plural = _("periods") - - -class EventPublicType(Named): - - class Meta: - verbose_name = _("public type") - verbose_name_plural = _("public types") - - -class EventTrainingLevel(Named): - - class Meta: - verbose_name = _("training level") - verbose_name_plural = _("training levels") - - -class EventTraining(models.Model): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='trainings', blank=True, null=True, on_delete=models.SET_NULL) - language = models.CharField(_('language'), max_length=64, blank=True, null=True, choices=settings.LANGUAGES) - public_type = models.ForeignKey(EventPublicType, verbose_name=_('public type'), related_name='trainings', blank=True, null=True, on_delete=models.SET_NULL) - level = models.ForeignKey(EventTrainingLevel, verbose_name=_('level'), related_name='trainings', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("training") - verbose_name_plural = _("trainings") - - -class EventRelatedTitle(RelatedTitle): - - event = models.OneToOneField(Event, verbose_name=_('event'), related_name='related_title', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = _("related title") - order_with_respect_to = "event" - - -class DynamicContentEvent(DynamicContent, Orderable): - - event = models.ForeignKey(Event, verbose_name=_('event'), related_name='dynamic_content_event', blank=True, null=True, on_delete=models.SET_NULL) - - class Meta: - verbose_name = 'Dynamic Content Event' - - -class EventPriceDescription(models.Model): - - event_price = models.OneToOneField(EventPrice, verbose_name=_('event_price_description'), related_name='event_price_description', blank=True, null=True, on_delete=models.SET_NULL) - description = models.TextField(_('description'), blank=True, null=True) - - class Meta: - verbose_name = 'Additionnal description' diff --git a/app/organization/agenda/translation.py b/app/organization/agenda/translation.py deleted file mode 100644 index 6764de58..00000000 --- a/app/organization/agenda/translation.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from modeltranslation.translator import translator, register, TranslationOptions - -from organization.agenda.models import * - - -@register(EventBlock) -class EventBlockTranslationOptions(TranslationOptions): - - fields = ('title', 'description', 'content') - - -@register(EventImage) -class EventImageTranslationOptions(TranslationOptions): - - fields = () - - -@register(EventPlaylist) -class EventPlaylistTranslationOptions(TranslationOptions): - - fields = () - - -@register(EventDepartment) -class EventDepartmentTranslationOptions(TranslationOptions): - - fields = () - - -@register(EventPerson) -class EventPersonTranslationOptions(TranslationOptions): - - fields = () - - -@register(EventLink) -class EventLinkTranslationOptions(TranslationOptions): - - fields = ('title',) - - -@register(EventPeriod) -class EventPeriodTranslationOptions(TranslationOptions): - - fields = () - - -@register(EventTraining) -class EventTrainingTranslationOptions(TranslationOptions): - - fields = () - - -@register(EventTrainingLevel) -class EventTrainingLevelTranslationOptions(TranslationOptions): - - fields = ('name',) - - -@register(EventPublicType) -class EventPublicTypeTranslationOptions(TranslationOptions): - - fields = ('name',) - - -@register(EventRelatedTitle) -class EventRelatedTitleTranslationOptions(TranslationOptions): - - fields = ('title',) - - -@register(DynamicContentEvent) -class DynamicContentEventTranslationOptions(TranslationOptions): - - fields = () - - -@register(EventPriceDescription) -class EventPriceDescriptionTranslationOptions(TranslationOptions): - - fields = ('description', ) - - -@register(EventPrice) -class EventPriceTranslationOptions(TranslationOptions): - - fields = () diff --git a/app/organization/agenda/urls.py b/app/organization/agenda/urls.py deleted file mode 100644 index fe74be4f..00000000 --- a/app/organization/agenda/urls.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from __future__ import unicode_literals - -import django.views.i18n -from django.contrib.auth.decorators import permission_required -from django.conf.urls import patterns, include, url -from django.conf.urls.i18n import i18n_patterns - -from mezzanine.core.views import direct_to_template -from mezzanine.conf import settings - -from organization.core.views import * -from organization.agenda.views import * - - -urlpatterns = [ - url("^%s/" % settings.EVENT_SLUG, include("mezzanine_agenda.urls")), - url("^%s/confirmation/(?P[0-9]*)$" % settings.EVENT_SLUG, ConfirmationView.as_view(), name="organization-agenda-confirmation"), - url("^dynamic-content-event/$", permission_required('event.can_edit')(DynamicContentEventView.as_view()), name='dynamic-content-event'), -] -# diff --git a/app/organization/agenda/views.py b/app/organization/agenda/views.py deleted file mode 100644 index 968bdc85..00000000 --- a/app/organization/agenda/views.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from datetime import datetime -from django.views.generic.base import TemplateView -from mezzanine.conf import settings -from dal import autocomplete -from dal_select2_queryset_sequence.views import Select2QuerySetSequenceView -from organization.magazine.models import Article -from organization.pages.models import CustomPage -from mezzanine_agenda.models import Event -from mezzanine_agenda.views import EventListView -from organization.core.views import autocomplete_result_formatting -from django.db.models import Q - - -class ConfirmationView(TemplateView): - - template_name = "agenda/confirmation.html" - - def get_context_data(self, **kwargs): - context = super(ConfirmationView, self).get_context_data(**kwargs) - context['confirmation_url'] = settings.EVENT_CONFIRMATION_URL % kwargs['transaction_id'] - return context - - -class DynamicContentEventView(Select2QuerySetSequenceView): - - paginate_by = settings.DAL_MAX_RESULTS - - def get_queryset(self): - - articles = Article.objects.all() - custompage = CustomPage.objects.all() - events = Event.objects.all() - - if self.q: - articles = articles.filter(title__icontains=self.q) - custompage = custompage.filter(title__icontains=self.q) - events = events.filter(title__icontains=self.q) - - qs = autocomplete.QuerySetSequence(articles, custompage, events,) - - if self.q: - qs = qs.filter(title__icontains=self.q) - - qs = self.mixup_querysets(qs) - - return qs - - def get_results(self, context): - results = autocomplete_result_formatting(self, context) - return results diff --git a/app/organization/core/__init__.py b/app/organization/core/__init__.py deleted file mode 100644 index 5db70c99..00000000 --- a/app/organization/core/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -""" -Provides abstract models and admin features used throughout the various -Mezzanine apps. -""" -from __future__ import unicode_literals - -default_app_config = 'organization.core.apps.CoreConfig' diff --git a/app/organization/core/admin.py b/app/organization/core/admin.py deleted file mode 100644 index 88d6b8d7..00000000 --- a/app/organization/core/admin.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.contrib import admin -from copy import deepcopy -from mezzanine.core.admin import * -from mezzanine.pages.admin import PageAdmin -from organization.core.models import * -from mezzanine.blog.models import BlogPost -from mezzanine.generic.models import ThreadedComment, Keyword -from mezzanine.conf import settings -from django.contrib.admin import SimpleListFilter - - -class KeywordAdmin(BaseTranslationModelAdmin): - - model = Keyword - - -class BaseTranslationOrderedModelAdmin(BaseTranslationModelAdmin): - - def get_fieldsets(self, request, obj = None): - res = super(BaseTranslationOrderedModelAdmin, self).get_fieldsets(request, obj) - fields = reversed(self.first_fields) - if settings.USE_MODELTRANSLATION: - lang = settings.LANGUAGE_CODE - lang_fields = [] - for field in fields: - lang_fields.append(field + '_' + lang) - fields = lang_fields - for field in fields: - for trans_field in res[0][1]['fields']: - if field in trans_field: - index = res[0][1]['fields'].index(trans_field) - res[0][1]['fields'].insert(0, res[0][1]['fields'].pop(index)) - return res - - -class NullListFilter(SimpleListFilter): - """Class to filter by null or not null any field in admin""" - def lookups(self, request, model_admin): - return ( - ('1', 'Null', ), - ('0', '!= Null', ), - ) - - def queryset(self, request, queryset): - if self.value() in ('0', '1'): - kwargs = { '{0}__isnull'.format(self.parameter_name) : self.value() == '1' } - return queryset.filter(**kwargs) - return queryset - - -def null_filter(field, title_=None): - """Helper to filter by null or not null any field in admin""" - class NullListFieldFilter(NullListFilter): - parameter_name = field - title = title_ or parameter_name - return NullListFieldFilter - - -admin.site.register(LinkType) -admin.site.unregister(BlogPost) -admin.site.unregister(ThreadedComment) -admin.site.register(Keyword, KeywordAdmin) diff --git a/app/organization/core/apps.py b/app/organization/core/apps.py deleted file mode 100644 index 79a3c7f7..00000000 --- a/app/organization/core/apps.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.apps import AppConfig - -from django.core.checks import register - - -class CoreConfig(AppConfig): - - name = 'organization.core' - label = 'organization-core' diff --git a/app/organization/core/context_processors.py b/app/organization/core/context_processors.py deleted file mode 100644 index 162cf467..00000000 --- a/app/organization/core/context_processors.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.conf import settings # import the settings file -from datetime import datetime, date -from organization.pages.models import Page -from organization.network.models import Organization, OrganizationLinkedInline -from mezzanine.utils.sites import current_site_id -from django.contrib.sites.models import Site - - -def settings(request): - date_now = datetime.now() - # SEASON - current_season = int(date_now.year) - 1 if datetime(date_now.year, 1,1) <= date_now and date_now <= datetime(date_now.year, 7, 31) else date_now.year - current_season_styled = str(current_season)[-2:]+"."+str(current_season+1)[-2:] - - # NEWSLETTER - newsletter_page = Page.objects.filter(slug="newsletter") - newsletter_subscribing_url = "" - if newsletter_page: - newsletter_subscribing_url = newsletter_page.first().get_absolute_url() - - # HOST ORGANIZATIONS - try: - site = Site.objects.get(id=current_site_id()) - host_org = Organization.objects.get(site=site) - except: - try: - host_org = Organization.objects.filter(is_host=True).first() - except: - host_org = Organization.objects.first() - - organization_lists = [] - - for orga_linked_block in host_org.organization_linked_block.all(): - organizations = [] - for orga_list in OrganizationLinkedInline.objects.filter(organization_list_id=orga_linked_block.organization_linked_id): - organizations.append(orga_list.organization) - organization_lists.append(organizations) - - linked_org_content = organization_lists[0] if len(organization_lists) > 0 else None - linked_org_footer = organization_lists[1] if len(organization_lists) > 1 else None - linked_org_footer_2 = organization_lists[2] if len(organization_lists) > 2 else None - - research_slug = "recherche" - - return {'current_season': current_season, - 'current_season_styled': current_season_styled, - 'newsletter_subscribing_url': newsletter_subscribing_url, - 'host_organization': host_org, - 'linked_organization_content' : linked_org_content, - 'linked_organization_footer' : linked_org_footer, - 'linked_organization_footer_2' : linked_org_footer_2, - 'research_slug' : research_slug - } diff --git a/app/organization/core/management/__init__.py b/app/organization/core/management/__init__.py deleted file mode 100644 index 12176181..00000000 --- a/app/organization/core/management/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - diff --git a/app/organization/core/management/commands/__init__.py b/app/organization/core/management/commands/__init__.py deleted file mode 100644 index 12176181..00000000 --- a/app/organization/core/management/commands/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - diff --git a/app/organization/core/management/commands/create-admin-user.py b/app/organization/core/management/commands/create-admin-user.py deleted file mode 100644 index 5a2ea04f..00000000 --- a/app/organization/core/management/commands/create-admin-user.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from optparse import make_option -from django.conf import settings -from django.core.management.base import BaseCommand, CommandError -from django.contrib.auth.models import User - - -class Command(BaseCommand): - help = """Create a default admin user if it doesn't exist. - you SHOULD change the password and the email afterwards!""" - - username = 'admin' - password = 'admin' - email = 'root@example.com' - - def handle(self, *args, **options): - admin = User.objects.filter(username=self.username) - if not admin: - user = User(username=self.username) - user.set_password(self.password) - user.email = self.email - user.is_superuser = True - user.is_staff = True - user.save() - print('User ' + self.username + ' created') diff --git a/app/organization/core/management/commands/festival-sync-eve-events.py b/app/organization/core/management/commands/festival-sync-eve-events.py deleted file mode 100644 index 0c22ee38..00000000 --- a/app/organization/core/management/commands/festival-sync-eve-events.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from datetime import datetime, timedelta -from optparse import make_option - -from django.conf import settings -from django.core.management.base import BaseCommand, CommandError -from django.contrib.auth.models import User -from django.core.mail import EmailMessage - -import mezzanine_agenda.models as ma_models -from mezzanine.generic.models import AssignedKeyword, Keyword - -import eve.models as eve_models - - -class Command(BaseCommand): - """Synchronize events from E-vement to mezzanine_agenda""" - - - option_list = BaseCommand.option_list + ( - make_option('-m', '--meta_event', - dest='meta_event', - help='define eve meta_event'), - ) - - default_user = User.objects.get(username='admin') - - - def cleanup(self): - # for event in ma_models.Event.objects.all(): - # event.delete() - # for location in ma_models.EventLocation.objects.all(): - # location.delete() - for event_price in ma_models.EventPrice.objects.all(): - event_price.delete() - - def handle(self, *args, **kwargs): - # self.cleanup() - meta_event_name = kwargs.get('meta_event') - meta_trans_all = eve_models.MetaEventTranslation.objects.all() - for meta_trans in meta_trans_all: - if meta_trans.name == meta_event_name: - break - eve_events = eve_models.Event.objects.filter(meta_event=meta_trans.id) - for eve_event in eve_events: - event_trans = eve_models.EventTranslation.objects.filter(id=eve_event, lang='fr')[0] - manifestations = eve_event.manifestations.all().order_by('happens_at') - first = True - for manifestation in manifestations: - events = ma_models.Event.objects.filter(external_id=manifestation.id) - if not events: - event = ma_models.Event(external_id=manifestation.id) - else: - event = events[0] - event.start = manifestation.happens_at - event.end = manifestation.happens_at + timedelta(seconds=manifestation.duration) - event.title = event_trans.name - event.user = self.default_user - - locations = ma_models.EventLocation.objects.filter(title=manifestation.location.name) - if locations: - location = locations[0] - else: - location = ma_models.EventLocation(title=manifestation.location.name) - address = '\n'.join([manifestation.location.address, manifestation.location.postalcode + ' ' + manifestation.location.city]) - location.address = address - location.external_id = manifestation.id - location.clean() - location.save() - event.location = location - event.save() - keyword, _ = Keyword.objects.get_or_create(title=eve_event.event_category.name) - event.keywords.add(AssignedKeyword(keyword=keyword), bulk=False) - - eve_prices = eve_models.PriceManifestation.objects.filter(manifestation=manifestation) - for price in eve_prices: - event_price, c = ma_models.EventPrice.objects.get_or_create(value=float(price.value)) - if event: - if not event_price in event.prices.all(): - event.prices.add(event_price) - - if not first: - event.parent = parent - else: - parent = event - first = False - - event.save() diff --git a/app/organization/core/management/commands/wait-for-db.py b/app/organization/core/management/commands/wait-for-db.py deleted file mode 100644 index 1848488c..00000000 --- a/app/organization/core/management/commands/wait-for-db.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -import os, time - -from optparse import make_option -from django.conf import settings -from django.core.management.base import BaseCommand, CommandError -from django.db import connections - - -class Command(BaseCommand): - help = "wait for default DB connection" - - db_name = 'default' - N = 20 - - def handle(self, *args, **options): - i = 0 - connected = False - db_conn = connections[self.db_name] - while not connected: - try: - c = db_conn.cursor() - connected = True - except: - print('error connecting to DB...') - if i > self.N: - print('...exiting') - raise - print('...retrying') - i += 1 - time.sleep(1) diff --git a/app/organization/core/managers.py b/app/organization/core/managers.py deleted file mode 100644 index c68adffc..00000000 --- a/app/organization/core/managers.py +++ /dev/null @@ -1,132 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from __future__ import unicode_literals - -import django -from future.builtins import int, zip - -from functools import reduce -from operator import ior, iand -from string import punctuation - -from django.apps import apps, AppConfig -from django.core.exceptions import ImproperlyConfigured -from django.db.models import Manager, Q, CharField, TextField -from django.db.models.manager import ManagerDescriptor -from django.db.models.query import QuerySet -from django.contrib.sites.managers import CurrentSiteManager as DjangoCSM -from django.utils.timezone import now -from django.utils.translation import ugettext_lazy as _ - -from mezzanine.conf import settings -from mezzanine.utils.sites import current_site_id -from mezzanine.utils.urls import home_slug -from mezzanine.core.managers import search_fields_to_dict, SearchableQuerySet, SearchableManager, DisplayableManager - - -class CustomSearchableManager(DisplayableManager): - - def search(self, *args, **kwargs): - """ - Proxy to queryset's search method for the manager's model and - any models that subclass from this manager's model if the - model is abstract. - """ - if not settings.SEARCH_MODEL_CHOICES: - # No choices defined - build a list of leaf models (those - # without subclasses) that inherit from Displayable. - models = [m for m in apps.get_models() - if issubclass(m, self.model)] - parents = reduce(ior, [set(m._meta.get_parent_list()) - for m in models]) - models = [m for m in models if m not in parents] - elif getattr(self.model._meta, "abstract", False): - # When we're combining model subclasses for an abstract - # model (eg Displayable), we only want to use models that - # are represented by the ``SEARCH_MODEL_CHOICES`` setting. - # Now this setting won't contain an exact list of models - # we should use, since it can define superclass models such - # as ``Page``, so we check the parent class list of each - # model when determining whether a model falls within the - # ``SEARCH_MODEL_CHOICES`` setting. - search_choices = set() - models = set() - parents = set() - errors = [] - for name in settings.SEARCH_MODEL_CHOICES: - try: - model = apps.get_model(*name.split(".", 1)) - except LookupError: - errors.append(name) - else: - search_choices.add(model) - if errors: - raise ImproperlyConfigured("Could not load the model(s) " - "%s defined in the 'SEARCH_MODEL_CHOICES' setting." - % ", ".join(errors)) - - for model in apps.get_models(): - # Model is actually a subclasses of what we're - # searching (eg Displayabale) - is_subclass = issubclass(model, self.model) - # Model satisfies the search choices list - either - # there are no search choices, model is directly in - # search choices, or its parent is. - this_parents = set(model._meta.get_parent_list()) - in_choices = not search_choices or model in search_choices - in_choices = in_choices or this_parents & search_choices - if is_subclass and (in_choices or not search_choices): - # Add to models we'll seach. Also maintain a parent - # set, used below for further refinement of models - # list to search. - models.add(model) - parents.update(this_parents) - # Strip out any models that are superclasses of models, - # specifically the Page model which will generally be the - # superclass for all custom content types, since if we - # query the Page model as well, we will get duplicate - # results. - models -= parents - elif self.model.__name__ == "CustomPage": - # gather all pages defined in PAGES_MODELS settings - models = set() - errors = [] - for name in settings.PAGES_MODELS: - try: - models.add(apps.get_model(name)) - except LookupError: - errors.append(name) - if errors: - raise ImproperlyConfigured("Could not load the model(s) " - "%s defined in the 'SEARCH_MODEL_CHOICES' setting." - % ", ".join(errors)) - else: - models = [self.model] - all_results = [] - user = kwargs.pop("for_user", None) - for model in models: - try: - queryset = model.objects.published(for_user=user) - except AttributeError: - queryset = model.objects.get_queryset() - all_results.extend(queryset.search(*args, **kwargs)) - return sorted(all_results, key=lambda r: r.result_count, reverse=True) diff --git a/app/organization/core/migrations/0001_initial.py b/app/organization/core/migrations/0001_initial.py deleted file mode 100644 index f65a4d6a..00000000 --- a/app/organization/core/migrations/0001_initial.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-01 15:26 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Category', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=512, verbose_name='name')), - ('description', models.TextField(blank=True, verbose_name='description')), - ], - options={ - 'verbose_name': 'category', - }, - ), - migrations.CreateModel( - name='LinkType', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=256, verbose_name='name')), - ('slug', models.SlugField(blank=True, help_text='Use this field to define a simple identifier that can be used to style the different link types (i.e. assign social media icons to them)', max_length=256, verbose_name='slug')), - ('ordering', models.PositiveIntegerField(blank=True, null=True, verbose_name='ordering')), - ], - options={ - 'ordering': ['ordering'], - }, - ), - ] diff --git a/app/organization/core/migrations/0002_linktype_picto.py b/app/organization/core/migrations/0002_linktype_picto.py deleted file mode 100644 index 9997fe06..00000000 --- a/app/organization/core/migrations/0002_linktype_picto.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-14 16:18 -from __future__ import unicode_literals - -from django.db import migrations -import mezzanine.core.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-core', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='linktype', - name='picto', - field=mezzanine.core.fields.FileField(default='', max_length=1024, verbose_name='picto'), - preserve_default=False, - ), - ] diff --git a/app/organization/core/migrations/0003_remove_linktype_picto.py b/app/organization/core/migrations/0003_remove_linktype_picto.py deleted file mode 100644 index 6c90e45a..00000000 --- a/app/organization/core/migrations/0003_remove_linktype_picto.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-21 13:02 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-core', '0002_linktype_picto'), - ] - - operations = [ - migrations.RemoveField( - model_name='linktype', - name='picto', - ), - ] diff --git a/app/organization/core/migrations/0004_auto_20160923_1141.py b/app/organization/core/migrations/0004_auto_20160923_1141.py deleted file mode 100644 index 906235d3..00000000 --- a/app/organization/core/migrations/0004_auto_20160923_1141.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-23 09:41 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-core', '0003_remove_linktype_picto'), - ] - - operations = [ - migrations.RenameModel( - old_name='Category', - new_name='CustomCategory', - ), - migrations.AlterModelOptions( - name='customcategory', - options={'verbose_name': 'custom category'}, - ), - ] diff --git a/app/organization/core/migrations/0005_linktype_fa_option.py b/app/organization/core/migrations/0005_linktype_fa_option.py deleted file mode 100644 index 9f8d034a..00000000 --- a/app/organization/core/migrations/0005_linktype_fa_option.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.10 on 2016-11-14 17:42 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organization-core', '0004_auto_20160923_1141'), - ] - - operations = [ - migrations.AddField( - model_name='linktype', - name='fa_option', - field=models.CharField(blank=True, help_text='will be added to fa-', max_length=64, null=True, verbose_name='fontawesome icon name option'), - ), - ] diff --git a/app/organization/core/migrations/__init__.py b/app/organization/core/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/app/organization/core/models.py b/app/organization/core/models.py deleted file mode 100644 index 8d7d31d7..00000000 --- a/app/organization/core/models.py +++ /dev/null @@ -1,319 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.db import models -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse, reverse_lazy -from django.contrib.contenttypes.models import ContentType -from django.contrib.contenttypes.fields import GenericForeignKey - -from mezzanine.pages.models import Page, RichText -from mezzanine.core.fields import RichTextField, OrderField, FileField -from mezzanine.core.models import Displayable, Slugged, Orderable - -from django_countries.fields import CountryField - - -COLOR_CHOICES = (('black', _('black')), ('yellow', _('yellow')), ('red', _('red')), ('white', _('white')),) - -ALIGNMENT_CHOICES = (('left', _('left')), ('center', _('center')), ('right', _('right'))) - -IMAGE_TYPE_CHOICES = (('logo', _('logo')), ('logo_white', _('logo white')), ('logo_black', _('logo black')), ('logo_header', _('logo header')), ('logo_footer', _('logo footer')), ('slider', _('slider')), ('card', _('card')), ('page_slider', _('page - slider')), ('page_featured', _('page - featured'))) - - -class Description(models.Model): - """Abstract model providing a description field""" - - description = models.TextField(_('description'), blank=True) - - class Meta: - abstract = True - - -class NamedOnly(models.Model): - """Abstract model providing a name field only""" - - name = models.CharField(_('name'), max_length=512, blank=True) - - class Meta: - abstract = True - - def __str__(self): - return self.name - - -class Named(models.Model): - """Abstract model providing a name field and a description""" - - name = models.CharField(_('name'), max_length=512) - description = models.TextField(_('description'), blank=True) - - class Meta: - abstract = True - ordering = ['name',] - - def __str__(self): - return self.name - - @property - def slug(self): - return slugify(self.__str__()) - - -class Titled(models.Model): - """Abstract model providing a title field""" - - title = models.CharField(_('title'), max_length=1024) - description = models.TextField(_('description'), blank=True) - - class Meta: - abstract = True - - def __str__(self): - return self.title - - -class SubTitled(models.Model): - - sub_title = models.TextField(_('sub title'), blank=True, max_length=1024) - - class Meta: - abstract = True - - -class CustomCategory(Named): - """Category description)""" - - class Meta: - verbose_name = _('custom category') - - def __str__(self): - return self.name - - -class Block(Titled, RichText, Orderable): - - with_separator = models.BooleanField(default=False) - background_color = models.CharField(_('background color'), max_length=32, choices=COLOR_CHOICES, blank=True) - login_required = models.BooleanField(_('login required'), default=False) - - class Meta: - abstract = True - - -class Image(Titled, Orderable): - - file = FileField(_("Image"), max_length=1024, format="Image", upload_to="images") - credits = models.CharField(_('credits'), max_length=256, blank=True, null=True) - type = models.CharField(_('type'), max_length=64, choices=IMAGE_TYPE_CHOICES) - - class Meta: - abstract = True - - def __str__(self): - value = self.description - if not value: - value = self.file.name - if not value: - value = "" - return value - - -class UserImage(Titled, Orderable): - - file = models.FileField(_("Image"), max_length=1024, upload_to="user/images/%Y/%m/%d/") - credits = models.CharField(_('credits'), max_length=256, blank=True, null=True) - - class Meta: - abstract = True - - def __str__(self): - value = self.description - if not value: - value = self.file.name - if not value: - value = "" - return value - - -class File(Titled, Orderable): - - file = FileField(_("document"), max_length=1024, upload_to="documents") - - class Meta: - abstract = True - - def __str__(self): - value = self.description - if not value: - value = self.file.name - if not value: - value = "" - return value - - -class DynamicContent(models.Model): - - # used for autocomplete but hidden in admin - content_type = models.ForeignKey( - ContentType, - verbose_name=_('content type'), - null=True, - blank=True, - editable=False, - ) - - # used for autocomplete but hidden in admin - object_id = models.PositiveIntegerField( - verbose_name=_('related object'), - null=True, - editable=False, - ) - - content_object = GenericForeignKey('content_type', 'object_id') - - class Meta: - abstract = True - - -class URL(models.Model): - - url = models.URLField(_('URL'), max_length=512, blank=True) - - class Meta: - abstract = True - - -class LinkType(models.Model): - """ - A link type could be ``Facebook`` or ``Twitter`` or ``Website``. - This is masterdata that should be created by the admins when the site is - deployed for the first time. - :ordering: Enter numbers here if you want links to be displayed in a - special order. - """ - - name = models.CharField(max_length=256, verbose_name=_('name')) - slug = models.SlugField(max_length=256, verbose_name=_('slug'), help_text=_( - 'Use this field to define a simple identifier that can be used' - ' to style the different link types (i.e. assign social media' - ' icons to them)'), - blank=True, - ) - ordering = models.PositiveIntegerField(verbose_name=_('ordering'), null=True, blank=True) - fa_option = models.CharField(max_length=64, verbose_name=_('fontawesome icon name option'), null=True, blank=True, help_text="will be added to fa-") - - class Meta: - ordering = ['ordering', ] - - def __str__(self): - return self.name - - -class Link(URL): - """A person can have many links.""" - - title = models.CharField(_('title'), max_length=1024, null=True, blank=True) - link_type = models.ForeignKey(LinkType, verbose_name=_('link type')) - - class Meta: - abstract = True - verbose_name = _('link') - verbose_name_plural = _('links') - - def __str__(self): - return self.url - - -class Period(models.Model): - - date_from = models.DateField(_('start date'), null=True, blank=True) - date_to = models.DateField(_('end date'), null=True, blank=True) - - class Meta: - abstract = True - - -class PeriodDateTime(models.Model): - - date_from = models.DateTimeField(_('begin date'), null=True, blank=True) - date_to = models.DateTimeField(_('end date'), null=True, blank=True) - - class Meta: - abstract = True - - -class AdminThumbRelatedMixin(object): - """ - Provides a thumbnail method on models for admin classes to - reference in the ``list_display`` definition. - """ - - admin_thumb_type = None - - def admin_thumb(self): - thumb = "" - if self.admin_thumb_type: - images = self.images.filter(type=self.admin_thumb_type) - if images: - thumb = images[0].file - if not thumb: - return "" - from mezzanine.conf import settings - from mezzanine.core.templatetags.mezzanine_tags import thumbnail - x, y = settings.ADMIN_THUMB_SIZE.split('x') - thumb_url = thumbnail(thumb, x, y) - return "" % (settings.MEDIA_URL, thumb_url) - admin_thumb.allow_tags = True - admin_thumb.short_description = "" - - -class Dated(models.Model): - - date_created = models.DateTimeField(_('creation date'), auto_now_add=True) - date_modified = models.DateTimeField(_('last modification date'), auto_now=True) - - class Meta: - abstract = True - - -class Address(models.Model): - """(Address description)""" - - address = models.TextField(_('address'), blank=True) - postal_code = models.CharField(_('postal code'), max_length=16, null=True, blank=True) - city = models.CharField(_('city'), max_length=255, null=True, blank=True) - country = CountryField(_('country'), null=True, blank=True) - - def __str__(self): - return ' '.join((self.address, self.postal_code)) - - class Meta: - abstract = True - - -class RelatedTitle(models.Model): - - title = models.CharField(_('title'), max_length=1024, null=True, blank=True) - - class Meta: - abstract = True diff --git a/app/organization/core/no_db_settings.py b/app/organization/core/no_db_settings.py deleted file mode 100644 index bd411627..00000000 --- a/app/organization/core/no_db_settings.py +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -try: - from local_settings import * -except ImportError: - pass -# Test runner with no database creation -TEST_RUNNER = 'organization.core.tests.NoDbTestRunner' diff --git a/app/organization/core/related.py b/app/organization/core/related.py deleted file mode 100644 index f128fc29..00000000 --- a/app/organization/core/related.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.core import exceptions -from django.db.models.fields.related import ForeignKey -from django.db.utils import ConnectionHandler, ConnectionRouter - -connections = ConnectionHandler() -router = ConnectionRouter() - - -class SpanningForeignKey(ForeignKey): - - def validate(self, value, model_instance): - if self.rel.parent_link: - return - # Call the grandparent rather than the parent to skip validation - super(ForeignKey, self).validate(value, model_instance) - if value is None: - return - - using = router.db_for_read(self.rel.to, instance=model_instance) - qs = self.rel.to._default_manager.using(using).filter( - **{self.rel.field_name: value} - ) - qs = qs.complex_filter(self.get_limit_choices_to()) - if not qs.exists(): - raise exceptions.ValidationError( - self.error_messages['invalid'], - code='invalid', - params={ - 'model': self.rel.to._meta.verbose_name, 'pk': value, - 'field': self.rel.field_name, 'value': value, - }, # 'pk' is included for backwards compatibility - ) diff --git a/app/organization/core/static/js/tinymce_setup.js b/app/organization/core/static/js/tinymce_setup.js deleted file mode 100644 index 64aaa7d4..00000000 --- a/app/organization/core/static/js/tinymce_setup.js +++ /dev/null @@ -1,104 +0,0 @@ -function custom_file_browser(field_name, url, type, win) { - return tinyMCE.activeEditor.windowManager.open({ - title: "Select " + type + " to insert", - file: window.__filebrowser_url + "?pop=5&type=" + type, - width: 800, - height: 500, - resizable: "yes", - scrollbars: "yes", - inline: "yes", - close_previous: "no" - }, { - window: win, - input: field_name - }), !1 -} -var language_codes = { - ar: "ar", - ca: "ca", - cs: "cs", - da: "da", - de: "de", - es: "es", - et: "et", - fa: "fa", - "fa-ir": "fa_IR", - fi: "fi", - fr: "fr_FR", - "hr-hr": "hr", - hu: "hu_HU", - "id-id": "id", - "is-is": "is_IS", - it: "it", - ja: "ja", - ko: "ko_KR", - lv: "lv", - nb: "nb_NO", - nl: "nl", - pl: "pl", - "pt-br": "pt_BR", - "pt-pt": "pt_PT", - ru: "ru", - sk: "sk", - sr: "sr", - sv: "sv_SE", - tr: "tr", - uk: "uk_UA", - vi: "vi", - "zh-cn": "zh_CN", - "zh-tw": "zh_TW", - "zh-hant": "zh_TW", - "zh-hans": "zh_CN" -}; -jQuery(function($) { - "undefined" != typeof tinyMCE && tinyMCE.init({ - selector: "textarea.mceEditor", - height: "500px", - language: language_codes[window.__language_code] || "en", - plugins: ["advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste"], - link_list: window.__link_list_url, - relative_urls: !1, - convert_urls: !1, - menubar: !0, - statusbar: !1, - toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image table | code fullscreen", - image_advtab: !0, - file_browser_callback: custom_file_browser, - content_css: [window.__tinymce_css, '/static/admin/css/organization.css', '/static/css/index.min.css'] , - valid_elements: "*[*]", - style_formats: [ - { - title: 'Boutons', items: [ - { title: 'Boutons Jaune', selector: 'a', classes: 'wys-button'}, - { title: 'Boutons Jaune Small', selector: 'a', classes: 'wys-button-small'}, - { title: 'Boutons Jaune XSmall', selector: 'a', classes: 'wys-button-xsmall'}, - { title: 'Boutons Noir', selector: 'a', classes: 'wys-button-black'}, - { title: 'Boutons Noir Small', selector: 'a', classes: 'wys-button-black-small'}, - { title: 'Boutons Noir XSmall', selector: 'a', classes: 'wys-button-black-xsmall'}, - { title: 'Boutons Blanc', selector: 'a', classes: 'wys-button-white'}, - { title: 'Boutons Blanc Small', selector: 'a', classes: 'wys-button-white-small'}, - { title: 'Boutons Blanc XSmall', selector: 'a', classes: 'wys-button-white-xsmall'} - ] - - }, - { - - title: 'Paragraphs', items: [ - { title: 'Highlighted paragraph', selector: 'p', classes: 'wys-highlighted-paragraph'}, - { title: 'Small paragraph', selector: 'p', classes: 'wys-small-text'} - ] - - }, - { - - title: 'Links', items: [ - { title: 'Unstyled link', selector: 'a', classes: 'wys-unstyled-link'} - ] - - } - ], - style_formats_merge: true - }) -}); - -//# sourceMappingURL=tinymce_setup.js.map diff --git a/app/organization/core/templatetags/organization_tags.py b/app/organization/core/templatetags/organization_tags.py deleted file mode 100644 index a3db871a..00000000 --- a/app/organization/core/templatetags/organization_tags.py +++ /dev/null @@ -1,240 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -# -*- coding: utf-8 -*- -import datetime -import calendar -from re import match -from django.http import QueryDict -from mezzanine.pages.models import Page -from mezzanine.blog.models import BlogPost -from mezzanine.template import Library -from mezzanine_agenda.models import Event -from mezzanine.conf import settings -from random import shuffle -from organization.magazine.models import * -from organization.projects.models import * - -register = Library() - - -@register.filter -def subtract(value, arg): - return value - arg - -@register.as_tag -def children_pages(page_id): - childrens = Page.objects.filter(parent_id=page_id).order_by('_order') - if childrens: - return childrens - return None - -@register.as_tag -def featured_edito(*args): - qs = Page.objects.filter(slug="edito") - if qs: - return qs[0].get_content_model() - else: - return None - -@register.as_tag -def featured_events(*args): - featured = Featured.objects.all() - if featured: - return featured[0].events.order_by('start') - return None - -@register.as_tag -def featured(*args): - featured_list = [] - featured = Featured.objects.filter(id=settings.HOME_FEATURED_ID) - if featured: - featured = featured[0] - for post in featured.blogposts.all(): - featured_list.append(post) - for video in featured.videos.all(): - featured_list.append(video) - for playlist in featured.playlists.all(): - featured_list.append(playlist) - shuffle(featured_list) - return featured_list - -@register.as_tag -def featured_breaking_news_content(*args): - featured = Featured.objects.filter(id=settings.BREAKING_NEWS_FEATURED_ID) - if featured: - featured = featured[0] - news = featured.pages.all() - if news: - return news[0].richtextpage.content - else: - return '' - return '' - -@register.filter -def get_class(obj): - return obj.__class__.__name__ - -@register.filter -def unique_posts(events): - post_list = [] - for event in events: - for post in event.blog_posts.all(): - if not post in post_list: - post_list.append(post) - return post_list - -@register.filter -def no_parents(events): - return events.filter(parent=None) - -@register.filter -def get_mezzanine_menu_name(menu_id): - if menu_id: - return settings.PAGE_MENU_TEMPLATES[int(menu_id)-1][1] - return 'None' - -@register.filter -def get_type(objects, type): - if objects: - objs = objects.filter(type=type) - if objs: - return objs - return None - -@register.filter -def get_type_link(objects, slug): - objs = objects.filter(link_type__slug=slug) - if objs: - return objs - return None - -@register.filter -def in_category(objects, category): - return objects.filter(category=type) - -@register.filter -def sub_topics(topic): - return ProjectTopic.objects.filter(parent=topic) - -@register.filter -def classname(obj): - return obj.__class__.__name__ - -@register.filter -def app_label_short(obj): - app_label = obj._meta.app_config.label - if app_label.find("_") > 0: - app_label_short = app_label.split("_")[1] - elif app_label.find("-") > 0: - app_label_short = app_label.split("-")[1] - else : - app_label_short = app_label - return app_label_short - -@register.as_tag -def activity_statuses(*args): - return ActivityStatus.objects.filter(display=True).exclude(parent__isnull=False) - -@register.filter -def get_team_persons(team, status): - persons = [] - statuses = status.children.all() - if not statuses: - statuses = [status,] - for status in statuses: - activities = status.activities.filter(teams__in=[team], date_to__gte=datetime.date.today()) - for activity in activities: - if not activity.person in persons: - persons.append(activity.person) - return persons - -@register.filter -def slice_ng(qs, indexes): - list = [] - for obj in qs: - list.append(obj) - index_split = indexes.split(':') - index_1 = int(index_split[0]) - index_2 = 0 - if len(index_split) > 1: - index_2 = int(index_split[1]) - if index_1 >= 0 and index_2: - return list[index_1:index_2] - else: - return [list[index_1]] - -@register.filter -def date_year_higher_than(date, years): - diff = date - datetime.date.today() - print(diff.days) - return diff.days > years*365 - -@register.simple_tag -def current_year(): - return datetime.datetime.now().strftime("%Y") - -@register.filter -def is_not_host(organizations): - return organizations.exclude(is_host=True) - -@register.filter -def unspam(email): - return email.replace('@', ' (at) ') - -@register.filter -def get_attr(obj, attr): - return getattr(obj, attr) - -@register.filter -def month_name(month_number): - return calendar.month_name[month_number] - -@register.filter -def format_wp(work_packages): - work_packages = [str(wk.number) for wk in work_packages] - return ",".join(work_packages) - -@register.filter -def format_percent(percent): - return str(percent * 100) + ' %' - -@register.filter -def get_media_type(media): - mime_type = media.transcoded.first().mime_type - media_type = "" - if match('video', mime_type): - media_type = "Video" - elif match('audio', mime_type): - media_type = "Audio" - return media_type - -@register.filter -def filter_content(dynamic_contents): - dict = {} - dict["event"] = [] - dict["other"] = [] - for dc in dynamic_contents: - if dc.content_object._meta.model_name== "event": - dict["event"].append(dc) - else : - dict["other"].append(dc) - return dict diff --git a/app/organization/core/tests.py b/app/organization/core/tests.py deleted file mode 100644 index 85b5bf83..00000000 --- a/app/organization/core/tests.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.test import TestCase -from django.test.runner import DiscoverRunner - -class NoDbTestRunner(DiscoverRunner): - """ A test runner to test without database creation """ - - def setup_databases(self, **kwargs): - """ Override the database creation defined in parent class """ - pass - - def teardown_databases(self, old_config, **kwargs): - """ Override the database teardown defined in parent class """ - pass diff --git a/app/organization/core/translation.py b/app/organization/core/translation.py deleted file mode 100644 index 6e7d602f..00000000 --- a/app/organization/core/translation.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from modeltranslation.translator import translator, register, TranslationOptions -from mezzanine.pages.models import Page, RichText -from mezzanine.pages.translation import TranslatedRichText -from mezzanine.generic.models import Keyword -from organization.core.models import * - - - -@register(Keyword) -class KeywordTranslationOptions(TranslationOptions): - - fields = ('title',) diff --git a/app/organization/core/urls.py b/app/organization/core/urls.py deleted file mode 100644 index 1574a563..00000000 --- a/app/organization/core/urls.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from __future__ import unicode_literals - -import django.views.i18n -from django.conf.urls import patterns, include, url -from django.conf.urls.i18n import i18n_patterns - -from mezzanine.core.views import direct_to_template -from mezzanine.conf import settings - -from organization.core.views import * - -urlpatterns = [ - url("^search/$", CustomSearchView.as_view(), name="search"), -] diff --git a/app/organization/core/views.py b/app/organization/core/views.py deleted file mode 100644 index a1f45aca..00000000 --- a/app/organization/core/views.py +++ /dev/null @@ -1,199 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017 Ircam -# Copyright (c) 2016-2017 Guillaume Pellerin -# Copyright (c) 2016-2017 Emilie Zawadzki - -# This file is part of mezzanine-organization. - -# 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 . - -from django.shortcuts import render, get_object_or_404 -from django.http import Http404 -from django.views.generic.base import View -from django.views.generic import DetailView, ListView, TemplateView, UpdateView -from django.apps import apps -from django.utils import six, timezone, formats -from django.utils.translation import ugettext_lazy as _ -from django.http import QueryDict -from django.template.defaultfilters import capfirst -from mezzanine.conf import settings -from mezzanine.utils.views import paginate -from organization.core.models import * -from functools import reduce -from operator import ior, iand -from organization.media.models import Playlist -from mezzanine_agenda.models import Event -from organization.pages.models import CustomPage -from organization.projects.models import Project -from extra_views import CreateWithInlinesView, UpdateWithInlinesView, InlineFormSet - - -class SlugMixin(object): - - def get_object(self): - objects = self.model.objects.all() - return get_object_or_404(objects, slug=self.kwargs['slug']) - - -class CustomSearchView(TemplateView): - - template_name='search_results.html' - - def get(self, request, *args, **kwargs): - """ - Display search results. Takes an optional "contenttype" GET parameter - in the form "app-name.ModelName" to limit search results to a single model. - """ - context = super(CustomSearchView, self).get_context_data(**kwargs) - query = request.GET.get("q", "") - page = request.GET.get("page", 1) - per_page = settings.SEARCH_PER_PAGE - max_paging_links = settings.MAX_PAGING_LINKS - is_searching_all = False - try: - parts = request.GET.get("type", "").split(".", 1) - search_model = apps.get_model(*parts) - search_model.objects.search # Attribute check - except (ValueError, TypeError, LookupError, AttributeError): - search_model = Displayable - search_type = _("Everything") - is_searching_all = True - else: - search_type = search_model._meta.verbose_name_plural.capitalize() - - # @Todo : rewrite SearchableManager - results = search_model.objects.search(query, for_user=request.user) - results_media_count = len(Playlist.objects.search(query, for_user=request.user)) - results_page_count = len(CustomPage.objects.search(query, for_user=request.user)) - results_event_count = len(Event.objects.search(query, for_user=request.user)) - results_project_count = len(Project.objects.search(query, for_user=request.user)) - - # count objects - filter_dict = dict() - - for result in results: - classname = result.__class__.__name__ - app_label = result._meta.app_label - full_classname = app_label+"."+classname - verbose_name = result._meta.verbose_name - # aggregate all Page types : CustomPage, TeamPage, Topic etc... - if result._meta.get_parent_list() : - parent_class = result._meta.get_parent_list()[0] - if full_classname in settings.PAGES_MODELS: - classname = "CustomPage" - verbose_name = "Page" - app_label = "organization-pages" - elif classname == "Playlist": - verbose_name = "Media" - if classname in filter_dict: - filter_dict[classname]['count'] += 1 - else: - filter_dict[classname] = {'count' : 1} - filter_dict[classname].update({'verbose_name' : verbose_name}) - filter_dict[classname].update({'app_label' : app_label}) - - # temporarily overriding filter_dict to get all filters manually - filter_dict = { - 'CustomPage': { - 'count' : results_page_count, - 'verbose_name' : 'Page', - 'app_label' : 'organization-pages' - }, - 'Event': { - 'count' : results_event_count, - 'verbose_name' : 'Event', - 'app_label' : 'mezzanine_agenda' - }, - 'Playlist': { - 'count' : results_media_count, - 'verbose_name' : 'Media', - 'app_label' : 'organization-media' - }, - 'Project': { - 'count' : results_project_count, - 'verbose_name' : 'Project', - 'app_label' : 'organization-projects' - }, - } - - # get url param - current_query = QueryDict(mutable=True) - current_query = request.GET.copy() - - # generate filter url - for key, value in filter_dict.items(): - current_query['type'] = value['app_label']+'.'+ key - filter_dict[key].update({'url' : request.path+"?"+current_query.urlencode(safe='/')}) - - # pagination - paginated = paginate(results, page, per_page, max_paging_links) - - # count all results - all_results_count = results_media_count + results_page_count + results_event_count - - # context - context = {"query": query, "results": paginated, - "search_type": search_type.__class__.__name__, "search_model": search_model.__name__, - "all_results_count" : all_results_count, 'is_searching_all': is_searching_all} - - # cancel filter url - if request.GET.__contains__('type'): - previous_query = QueryDict(mutable=True) - previous_query = request.GET.copy() - previous_query.pop('type') - context['cancel_filter_url'] = '?'+previous_query.urlencode(safe='/') - - context['filter_dict'] = filter_dict - # context.update(extra_context or {}) - return self.render_to_response(context) - - -def autocomplete_result_formatting(self, context): - """ - Return a list of results usable by Select2. - It will render as a list of one per different content type - containing a list of one