--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-25 10:32
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organization-core', '0002_auto_20160824_1454'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='displayableimage',
+ name='type',
+ field=models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page slider')], max_length=64, verbose_name='type'),
+ ),
+ migrations.AlterField(
+ model_name='modelimage',
+ name='type',
+ field=models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page slider')], max_length=64, verbose_name='type'),
+ ),
+ ]
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-25 10:32
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organization-network', '0002_auto_20160824_0020'),
+ ('organization-magazine', '0002_auto_20160824_1454'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='article',
+ name='department',
+ field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='organization-network.Department'),
+ preserve_default=False,
+ ),
+ migrations.AlterField(
+ model_name='articleimage',
+ name='type',
+ field=models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page slider')], max_length=64, verbose_name='type'),
+ ),
+ ]
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-25 10:59
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organization-magazine', '0003_auto_20160825_1232'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='article',
+ name='department',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='department', to='organization-network.Department'),
+ ),
+ ]
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-25 11:08
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organization-magazine', '0004_auto_20160825_1259'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='article',
+ name='department',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='articles', to='organization-network.Department'),
+ ),
+ ]
from mezzanine.core.models import RichText, Displayable, Slugged
from mezzanine.pages.models import Page
from mezzanine.blog.models import BlogPost
-
+from organization.network.models import Department
from organization.core.models import *
related_articles = models.ManyToManyField("self",
verbose_name=_("Related articles"), blank=True)
-
+ department = models.ForeignKey(Department, related_name='articles', limit_choices_to=dict(id__in=Department.objects.all()), blank=True, null=True, on_delete=models.SET_NULL)
model_name = _('article')
def get_absolute_url(self):
template_name='magazine/article/article_detail.html'
context_object_name = 'article'
- # def get_context_data(self, **kwargs):
- # # context = super(ArticleDetailView, self).get_context_data(**kwargs)
- # # if self.topic_parent:
- # # context['topic_parent'] = self.topic_parent.all()[0]
- # # if self.department_parent:
- # # context['department_parent'] = self.department_parent.all()[0]
- # return context
+ def get_context_data(self, **kwargs):
+ article = self.get_object()
+ context = super(ArticleDetailView, self).get_context_data(**kwargs)
+ if article.department:
+ context['department_weaving_css_class'] = article.department.pages.first().weaving_css_class
+ context['department_name'] = article.department.name
+ return context
class ArticleListView(SlugMixin, ListView):
model = Article
template_name='magazine/article/article_list.html'
- # context_object_name = 'article'
+ context_object_name = 'article'
def get_context_data(self, **kwargs):
context = super(ArticleListView, self).get_context_data(**kwargs)
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-25 10:32
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organization-pages', '0003_auto_20160824_1550'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='pageimage',
+ name='type',
+ field=models.CharField(choices=[('logo', 'logo'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page slider')], max_length=64, verbose_name='type'),
+ ),
+ ]
{% endblock %}
{% block body_class %}
- {% if department_parent %}
- pattern pattern-bg {{ department_parent.weaving_css_class }}
+ {% if department_weaving_css_class %}
+ pattern pattern-bg {{ department_weaving_css_class }}
{% endif %}
{% endblock %}
{% block breadcrumb_menu %}
{{ block.super }}
-
<li class="breadcrumb__item active">{{ article.title }}</li>
{% endblock %}
<div class="tag tag--category">
{% trans 'News' %}
</div>
- {% if article.keywords %}
+ {% if department_name %}
<div class="tag dashed dashed--gray">
- {{ article.keywords.first }}
+ {{ department_name }}
</div>
{% endif %}
<div class="tag tag--small tag--category">
{% trans 'News' %}
</div>
- {% if article.keywords %}
+ {% if article.department %}
<div class="tag tag--small dashed dashed--gray">
- {{ article.keywords.first }}
+ {{ article.department.name }}
</div>
{% endif %}
</div>
django-countries
django-querysetsequence
django-autocomplete-light
+ipython