-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sf_update_fork' into sf_update_fork_fix_conflit
- Loading branch information
Showing
34 changed files
with
1,087 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.10 | ||
FROM python:3.11 | ||
|
||
EXPOSE ${CONTAINER_PORT} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import factory | ||
from wagtail.models import Page | ||
|
||
from content_manager.models import ContentPage | ||
|
||
|
||
class PageFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
abstract = True | ||
|
||
# override the _create method, to establish parent-child relationship between page and home | ||
@classmethod | ||
def _create(cls, model_class, *args, **kwargs): | ||
parent = Page.objects.filter(slug="home").first() | ||
page = model_class(*args, **kwargs) | ||
parent.add_child(instance=page) | ||
return page | ||
|
||
|
||
class ContentPageFactory(PageFactory): | ||
"""Generates ContentPage() objects for unit tests.""" | ||
|
||
class Meta: | ||
model = ContentPage | ||
|
||
class Params: | ||
with_seo_title = factory.Trait( | ||
seo_title=factory.Faker("sentence", nb_words=5, variable_nb_words=True, locale="fr_FR") | ||
) | ||
with_search_description = factory.Trait( | ||
search_description=factory.Faker("sentence", nb_words=10, variable_nb_words=True, locale="fr_FR") | ||
) | ||
|
||
slug = factory.Faker("slug") | ||
title = factory.Faker("sentence", nb_words=5, locale="fr_FR") |
4 changes: 2 additions & 2 deletions
4
content_manager/templates/content_manager/blocks/heading.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{% if self.get_ancestors|length > 1 %} | ||
<div class="fr-container fr-mt-1w"> | ||
<div class="fr-grid-row fr-grid-row--gutters"> | ||
<div class="fr-col-12"> | ||
<nav role="navigation" class="fr-breadcrumb" aria-label="vous êtes ici :"> | ||
<button type="button" | ||
class="fr-breadcrumb__button" | ||
aria-expanded="false" | ||
aria-controls="breadcrumb-1"> | ||
Voir le fil d’Ariane | ||
</button> | ||
<div class="fr-collapse" id="breadcrumb-1"> | ||
<ol class="fr-breadcrumb__list"> | ||
{% for link in self.get_ancestors %} | ||
{% if link.is_root == False %} | ||
<li> | ||
<a class="fr-breadcrumb__link" href="{{ link.url }}">{{ link.title }}</a> | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
<li> | ||
<a aria-current="page" | ||
class="fr-breadcrumb__link router-link-exact-active">{{ page.title }}</a> | ||
</li> | ||
</ol> | ||
</div> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
{% endif %} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class FormationsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "formations" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.db import models | ||
|
||
|
||
class Kind(models.TextChoices): | ||
FORMATION = "formation", "Formation" | ||
PARCOURS = "parcours", "Parcours" | ||
CYCLE = "cycle", "Cycle" | ||
SEMINAIRE = "séminaire", "Séminaire" | ||
UNIVERSITE = "université d'été", "Université d'été" | ||
PROGRAMME = "programme", "Programme" | ||
|
||
|
||
class Attendance(models.TextChoices): | ||
ENLIGNE = "enligne", "En ligne" | ||
PRESENTIEL = "présentiel", "Présentiel" | ||
HYBRIDE = "hybride", "Hybride" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import factory | ||
import factory.fuzzy | ||
|
||
from content_manager.factories import ContentPageFactory | ||
from formations.enums import Attendance, Kind | ||
from formations.models import FormationPage, Organizer, TargetAudience, Theme | ||
|
||
|
||
class TargetAudienceFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = TargetAudience | ||
|
||
name = factory.Faker("sentence", nb_words=3, locale="fr_FR") | ||
|
||
|
||
class ThemeFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Theme | ||
|
||
name = factory.Faker("sentence", nb_words=3, locale="fr_FR") | ||
airtable_id = factory.Faker("random_int", min=0, max=10000) | ||
|
||
|
||
class OrganizerFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Organizer | ||
|
||
name = factory.Faker("sentence", nb_words=3, locale="fr_FR") | ||
airtable_id = factory.Faker("random_int", min=0, max=10000) | ||
|
||
|
||
class FormationPageFactory(ContentPageFactory): | ||
class Meta: | ||
model = FormationPage | ||
|
||
name = factory.Faker("sentence", nb_words=3, locale="fr_FR") | ||
kind = factory.fuzzy.FuzzyChoice(Kind.values) | ||
short_description = factory.Faker("sentence", nb_words=15, locale="fr_FR") | ||
knowledge_at_the_end = factory.Faker("sentence", nb_words=15, locale="fr_FR") | ||
duration = factory.Faker("sentence", nb_words=1, locale="fr_FR") | ||
registration_link = factory.Faker("url") | ||
image_url = factory.Faker("url") | ||
attendance = factory.fuzzy.FuzzyChoice(Attendance.values) | ||
|
||
@factory.post_generation | ||
def target_audience(self, create, extracted, **kwargs): | ||
if not create: | ||
return | ||
|
||
if extracted: | ||
for audience in extracted: | ||
self.target_audience.add(audience) | ||
|
||
@factory.post_generation | ||
def themes(self, create, extracted, **kwargs): | ||
if not create: | ||
return | ||
|
||
if extracted: | ||
for theme in extracted: | ||
self.themes.add(theme) | ||
|
||
@factory.post_generation | ||
def organizers(self, create, extracted, **kwargs): | ||
if not create: | ||
return | ||
|
||
if extracted: | ||
for organizer in extracted: | ||
self.organizers.add(organizer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django import forms | ||
|
||
from formations.models import Theme | ||
|
||
|
||
class FormationsFilterForm(forms.Form): | ||
themes = forms.ModelMultipleChoiceField( | ||
label="Thématiques", | ||
queryset=Theme.objects.filter(formationpage__isnull=False).distinct(), | ||
widget=forms.CheckboxSelectMultiple( | ||
attrs={ | ||
"class": "form-checkbox fr-input vh", | ||
"onchange": "this.form.submit()", | ||
} | ||
), | ||
required=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Generated by Django 4.1.10 on 2023-09-29 09:25 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("wagtailcore", "0078_referenceindex"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="FormationPage", | ||
fields=[ | ||
( | ||
"page_ptr", | ||
models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
serialize=False, | ||
to="wagtailcore.page", | ||
), | ||
), | ||
("airtable_record_id", models.CharField(blank=True, db_index=True, max_length=35)), | ||
("name", models.CharField(max_length=255, verbose_name="Intitulé")), | ||
( | ||
"kind", | ||
models.CharField( | ||
blank=True, | ||
choices=[ | ||
("formation", "Formation"), | ||
("parcours", "Parcours"), | ||
("cycle", "Cycle"), | ||
("séminaire", "Séminaire"), | ||
("université d'été", "Université d'été"), | ||
("programme", "Programme"), | ||
], | ||
max_length=20, | ||
verbose_name="Type", | ||
), | ||
), | ||
("short_description", models.TextField(blank=True, verbose_name="Descriptif court")), | ||
("knowledge_at_the_end", models.TextField(blank=True, verbose_name="À la fin, vous saurez")), | ||
("duration", models.IntegerField(blank=True, null=True, verbose_name="Durée (min)")), | ||
("registration_link", models.URLField(blank=True, max_length=255, verbose_name="Lien d'inscription")), | ||
("image_url", models.URLField(blank=True, null=True, verbose_name="URL Image")), | ||
("visible", models.TextField(blank=True, verbose_name="Visible")), | ||
], | ||
options={ | ||
"verbose_name": "Page Formation/Parcours", | ||
}, | ||
bases=("wagtailcore.page", models.Model), | ||
), | ||
] |
Oops, something went wrong.