Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMS] Ajout de pages "privée" de wagtails #1054

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@
LOGIN_REDIRECT_URL = "/"
LOGOUT_REDIRECT_URL = "/"


# Django Sesame
# https://django-sesame.readthedocs.io/en/stable/index.html
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -852,6 +851,7 @@

WAGTAILADMIN_BASE_URL = DEPLOY_URL or "http://localhost/"

WAGTAIL_FRONTEND_LOGIN_URL = LOGIN_URL

# Shell Plus (django-extensions)
# ------------------------------------------------------------------------------
Expand Down
33 changes: 33 additions & 0 deletions lemarche/cms/migrations/0009_paidarticlelist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.2.9 on 2024-01-24 16:21

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("cms", "0008_alter_homepage_content"),
]

operations = [
migrations.CreateModel(
name="PaidArticleList",
fields=[
(
"articlelist_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="cms.articlelist",
),
),
],
options={
"abstract": False,
},
bases=("cms.articlelist",),
),
]
6 changes: 5 additions & 1 deletion lemarche/cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_template(self, request, *args, **kwargs):
),
]

parent_page_types = ["cms.ArticleList"]
parent_page_types = ["cms.ArticleList", "cms.PaidArticleList"]
subpage_types = []


Expand Down Expand Up @@ -147,6 +147,10 @@ def post_search(self, request, *args, **kwargs):
subpage_types = ["cms.ArticlePage"]


class PaidArticleList(ArticleList):
pass


class HomePage(Page):
max_count = 1
banner_title = models.CharField(
Expand Down
45 changes: 45 additions & 0 deletions lemarche/templates/cms/paid_article_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% extends "layouts/base.html" %}
{% load wagtailcore_tags wagtailimages_tags wagtailroutablepage_tags %}
{% block meta_description %}<meta name="description" content="{{ page.search_description }}">{% endblock %}
{% block title %}{{ page.seo_title }} {{ block.super }}{% endblock %}
{% block body_class %}p-ressources{{ block.super }}{% endblock %}
{% block breadcrumbs %}
<section>
<div class="container">
<div class="row">
<div class="col-12">
<nav class="c-breadcrumb c-breadcrumb--marche" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{% url 'wagtail_serve' '' %}">Accueil</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ page.title }}</li>
</ol>
</nav>
</div>
</div>
</div>
</section>
{% endblock breadcrumbs %}
{% block content %}
<section class="s-title-01 mb-0">
<div class="s-title-01__container container">
<div class="s-title-01__row row">
<div class="s-title-01__col col-12 col-lg-9">
<h1 class="s-title-01__title h1">
<strong>{{ page.title }}</strong>
</h1>
</div>
</div>
</div>
</section>
<section class="s-section mt-0 has-illustration-bg-02">
<div class="s-section__container container">
<div class="s-section__row row row-cols-1 row-cols-md-2 row-cols-lg-3 mt-5">
{% for article in article_list %}
<div class="s-section__col col mb-3 mb-lg-5">{% include "cms/article_item.html" with article=article %}</div>
{% endfor %}
</div>
</div>
</section>
{% endblock content %}
5 changes: 4 additions & 1 deletion lemarche/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ class UserAdmin(FieldsetsInlineMixin, UserAdmin):
},
),
("API", {"fields": ("api_key", "api_key_last_updated")}),
("Permissions", {"fields": ("is_active", "is_staff", "is_superuser")}),
(
"Permissions",
{"fields": ("is_active", "is_staff", "is_superuser", "groups")},
),
(
"Données C4 Cocorico",
{
Expand Down
Loading