diff --git a/mpicms/base/migrations/0007_remove_wikipage_date.py b/mpicms/base/migrations/0007_remove_wikipage_date.py new file mode 100644 index 0000000..ac592a6 --- /dev/null +++ b/mpicms/base/migrations/0007_remove_wikipage_date.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.1 on 2019-05-28 14:00 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0006_contacts_position'), + ] + + operations = [ + migrations.RemoveField( + model_name='wikipage', + name='date', + ), + ] diff --git a/mpicms/base/models.py b/mpicms/base/models.py index 3e48b62..3138166 100644 --- a/mpicms/base/models.py +++ b/mpicms/base/models.py @@ -1,3 +1,4 @@ +from django.apps import apps from django.db import models from django.utils.translation import gettext as _ @@ -11,7 +12,7 @@ from wagtail.images.blocks import ImageChooserBlock from wagtail.snippets.edit_handlers import SnippetChooserPanel -from mpicms.news.models import NewsPage +from mpicms.news.mixins import NewsMixin Page.show_in_menus_default = True @@ -45,22 +46,17 @@ class Meta: # noqa abstract = True -class HomePage(Page): +class HomePage(NewsMixin, Page): parent_page_types = ['wagtailcore.Page'] # Restrict parent to be root content_panels = Page.content_panels - def get_context(self, request): - context = super().get_context(request) - context['news'] = NewsPage.objects.first() - return context - class Meta: # noqa verbose_name = _("homepage") verbose_name_plural = _("homepages") -class CategoryPage(Page): +class CategoryPage(NewsMixin, Page): body = RichTextField(_("content"), blank=True) side_content = RichTextField( _("sidebar content"), blank=True, @@ -94,7 +90,6 @@ class WikiPage(CategoryMixin, Page): ('image', ImageChooserBlock()), ('url', blocks.URLBlock()) ], blank=True) - date = models.DateField("Post date", auto_now_add=True) search_fields = Page.search_fields + [ index.SearchField('body'), diff --git a/mpicms/news/migrations/0004_newsentry_date.py b/mpicms/news/migrations/0004_newsentry_date.py new file mode 100644 index 0000000..4ed78c2 --- /dev/null +++ b/mpicms/news/migrations/0004_newsentry_date.py @@ -0,0 +1,20 @@ +# Generated by Django 2.2.1 on 2019-05-28 14:00 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0003_auto_20190525_1616'), + ] + + operations = [ + migrations.AddField( + model_name='newsentry', + name='date', + field=models.DateField(auto_now_add=True, default=datetime.date(2019, 5, 28), verbose_name='Post date'), + preserve_default=False, + ), + ] diff --git a/mpicms/news/mixins.py b/mpicms/news/mixins.py new file mode 100644 index 0000000..965aec7 --- /dev/null +++ b/mpicms/news/mixins.py @@ -0,0 +1,13 @@ +from django.apps import apps +from django.db import models + + +class NewsMixin(models.Model): + + @property + def news(self): + news_page = apps.get_model('news', 'NewsPage') + return self.get_children().type(news_page) + + class Meta: # noqa + abstract = True diff --git a/mpicms/news/models.py b/mpicms/news/models.py index 66f5672..1bee895 100644 --- a/mpicms/news/models.py +++ b/mpicms/news/models.py @@ -5,8 +5,10 @@ from wagtail.core.fields import RichTextField from wagtail.admin.edit_handlers import FieldPanel +from mpicms.base.models import CategoryMixin -class NewsPage(Page): + +class NewsPage(CategoryMixin, Page): content_panels = Page.content_panels parent_page_types = ['base.CategoryPage', 'base.HomePage'] @@ -18,9 +20,10 @@ class Meta: # noqa verbose_name_plural = _("news Blogs") -class NewsEntry(Page): +class NewsEntry(CategoryMixin, Page): preview = models.TextField(_("preview"), blank=True) body = RichTextField(_("content")) + date = models.DateField("Post date", auto_now_add=True) content_panels = Page.content_panels + [ FieldPanel('preview'), diff --git a/mpicms/static/css/custom.css b/mpicms/static/css/custom.css index b7133f8..50e7a30 100644 --- a/mpicms/static/css/custom.css +++ b/mpicms/static/css/custom.css @@ -88,6 +88,7 @@ select, input { padding-left: 2rem; padding-bottom: 2rem; margin-top: 3rem; + align-content: flex-start; } .sidebar ul { @@ -116,6 +117,18 @@ select, input { flex: 0 0 100%; } +.sidebar time { + color: black; + font-size: 85%; + text-align: end; + flex-basis: 100%; +} + +.event-button { + display: flex !important; + flex-wrap: wrap; +} + .contact { padding-bottom: 1em; line-height: 90%; @@ -166,8 +179,9 @@ select, input { .card { margin: 1rem; flex-grow: 1; - flex-basis: auto; + flex-basis: 18rem; width: inherit; + flex-shrink: 0; } .flex-align { @@ -175,12 +189,11 @@ select, input { flex-wrap: nowrap; align-items: center; justify-content: space-between; - width: 100%; } .flex-base { display: flex !important; - flex-wrap: nowrap; + flex-wrap: wrap; align-items: stretch; width: 100%; } @@ -224,4 +237,8 @@ select, input { .fa-chevron-right { padding-left: 0.8rem; +} + +.select:not(.is-multiple):not(.is-loading)::after { + border-color: #006c66; } \ No newline at end of file diff --git a/mpicms/templates/base/category_page.html b/mpicms/templates/base/category_page.html index 2afe92a..6afd8ed 100644 --- a/mpicms/templates/base/category_page.html +++ b/mpicms/templates/base/category_page.html @@ -9,6 +9,9 @@