--- /dev/null
+# -*- 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'),
+ ),
+ ]
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
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
+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 _
model = Playlist
template_name='media/playlist_list.html'
context_object_name = 'playlists'
+
def get_queryset(self):
self.qs = Playlist.objects.all()
self.current_type = None
self.qs = self.qs.filter(type=self.kwargs['type'])
self.current_type = self.kwargs['type']
return self.qs
+
def get_context_data(self, **kwargs):
context = super(PlaylistListView, self).get_context_data(**kwargs)
--- /dev/null
+# -*- 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-network', '0076_auto_20161230_1839'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='organizationblock',
+ name='login_required',
+ field=models.BooleanField(default=False, verbose_name='login required'),
+ ),
+ migrations.AddField(
+ model_name='personblock',
+ name='login_required',
+ field=models.BooleanField(default=False, verbose_name='login required'),
+ ),
+ ]
--- /dev/null
+# -*- 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-pages', '0016_auto_20161205_1536'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='pageblock',
+ name='login_required',
+ field=models.BooleanField(default=False, verbose_name='login required'),
+ ),
+ ]
--- /dev/null
+# -*- 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-projects', '0034_auto_20161230_1839'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='projectblock',
+ name='login_required',
+ field=models.BooleanField(default=False, verbose_name='login required'),
+ ),
+ ]
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2017-01-03 11:27
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import mezzanine.core.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organization-projects', '0035_projectblock_login_required'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='projectblock',
+ name='content_en',
+ field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'),
+ ),
+ migrations.AddField(
+ model_name='projectblock',
+ name='content_fr',
+ field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'),
+ ),
+ migrations.AddField(
+ model_name='projectblock',
+ name='description_en',
+ field=models.TextField(blank=True, null=True, verbose_name='description'),
+ ),
+ migrations.AddField(
+ model_name='projectblock',
+ name='description_fr',
+ field=models.TextField(blank=True, null=True, verbose_name='description'),
+ ),
+ migrations.AddField(
+ model_name='projectblock',
+ name='title_en',
+ field=models.CharField(max_length=1024, null=True, verbose_name='title'),
+ ),
+ migrations.AddField(
+ model_name='projectblock',
+ name='title_fr',
+ field=models.CharField(max_length=1024, null=True, verbose_name='title'),
+ ),
+ ]
class ProjectBlock(Block):
-
project = models.ForeignKey(Project, verbose_name=_('project'), related_name='blocks', blank=True, null=True, on_delete=models.SET_NULL)
@register(ProjectBlock)
class ProjectBlockTranslationOptions(TranslationOptions):
- pass
+ fields = ('title', 'description', 'content')
@register(ProjectLink)
from organization.magazine.views import Article
from organization.pages.models import CustomPage
-class ProjectDetailView(SlugMixin, DetailView):
- model = Project
- template_name='projects/project_detail.html'
- context_object_name = 'project'
+class ProjectMixin(object):
- def get_context_data(self, **kwargs):
- context = super(ProjectDetailView, self).get_context_data(**kwargs)
- project = self.get_object()
+ def get_context_data_mixin(self, context):
department = None
- if project.lead_team:
- if project.lead_team.department:
- department = project.lead_team.department
+ if self.project.lead_team:
+ if self.project.lead_team.department:
+ department = self.project.lead_team.department
else:
- for team in project.teams.all():
+ for team in self.project.teams.all():
if team.department:
department = team.department
break
context['department'] = department
- if project.topic and project.topic.parent:
- context['page'] = project.topic.parent.pages.all().first()
- elif project.topic:
- context['page'] = project.topic.pages.all().first()
+ if self.project.topic and self.project.topic.parent:
+ context['page'] = self.project.topic.parent.pages.all().first()
+ elif self.project.topic:
+ context['page'] = self.project.topic.pages.all().first()
+
+ return context
+
+
+class ProjectDetailView(SlugMixin, ProjectMixin, DetailView):
+
+ model = Project
+ template_name='projects/project_detail.html'
+ context_object_name = 'project'
+
+ def get_context_data(self, **kwargs):
+ context = super(ProjectDetailView, self).get_context_data(**kwargs)
+ self.project = self.get_object()
+ self.get_context_data_mixin(context)
+ context['next'] = reverse_lazy('organization-project-detail', kwargs={'slug': self.project.slug})
return context
return results
-class ProjectDemoDetailView(SlugMixin, DetailView):
+class ProjectDemoDetailView(SlugMixin, ProjectMixin, DetailView):
model = ProjectDemo
template_name='projects/project_demo_detail.html'
context = super(ProjectDemoDetailView, self).get_context_data(**kwargs)
demo = self.get_object()
project = demo.project
- department = None
-
- if project:
- if project.lead_team:
- if project.lead_team.department:
- department = project.lead_team.department
- else:
- for team in project.teams.all():
- if team.department:
- department = team.department
- break
-
- context['department'] = department
- if project.topic and project.topic.parent:
- context['page'] = project.topic.parent.pages.all().first()
- elif project.topic:
- context['page'] = project.topic.pages.all().first()
-
+ self.get_context_data_mixin(context)
return context
{% else %}
{% include 'accounts/account_form.html'%}
{% url "signup" as signup_url %}
- <p>{% blocktrans with request.GET.next as next %}If you don't have an account you can <a href="{{ signup_url }}?next={{ next }}">sign up</a> for one now.{% endblocktrans %}</p>
{% url "mezzanine_password_reset" as password_reset_url %}
{% url "profile_update" as profile_update_url %}
{% blocktrans %}<p>You can also <a href="{{ password_reset_url }}?next={{ profile_update_url }}">reset your password</a> if you've forgotten it.</p>{% endblocktrans %}</p>
{% load i18n mezzanine_tags keyword_tags pages_tags organization_tags %}
{% if blocks %}
<div class="white-bg pb2">
- {% if blocks.first.content %}
+ {% if blocks.first %}
<hr class="mt0" />
{% endif %}
{% for block in blocks %}
--- /dev/null
+{% load i18n mezzanine_tags keyword_tags pages_tags organization_tags %}
+{% if blocks %}
+ <div class="white-bg pb2">
+ {% for block in blocks %}
+ {% if block.content %}
+ {% if not forloop.first and block.with_separator %}
+ <hr />
+ {% endif %}
+ <div class="page__block{% if block.background_color %} page__block--{{ block.background_color }}{% endif %}">
+ <div class="container">
+ <div class="row" data-summary-content>
+ <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2">
+ {% editable block.title %}
+ <h2 class="dotted">{{ block.title }}</h2>
+ {% endeditable %}
+ {% if block.description %}
+ <div class="chapo">
+ {% editable block.description %}
+ {{ block.description }}
+ {% endeditable %}
+ </div>
+ {% endif %}
+ {% if block.login_required and not user.is_authenticated %}
+ <div class="chapo">
+ {% trans "Please login to get links to the data" %}<br><br>
+ <a class="button" href="{% url 'login' %}?next={{ next }}#section-0" title="Login">{% trans "Login" %}</a>
+ </div>
+ {% else %}
+ {% if block.content %}
+ {% editable block.content %}
+ {{ block.content|richtext_filters|safe }}
+ {% endeditable %}
+ {% endif %}
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ </div>
+ {% endif %}
+ {% endfor %}
+ {% if blocks.last %}
+ <hr class="mt0" />
+ {% endif %}
+ </div>
+{% endif %}
{% endif %}
{% with project.blocks.all as blocks %}
- {% include "core/inc/block.html" %}
+ {% include "projects/inc/project_block.html" %}
{% endwith %}
{% endblock %}