eucrim.core package

Subpackages

Submodules

eucrim.core.abstracts module

class eucrim.core.abstracts.AbstractNewsCategory(*args, **kwargs)[source]

Bases: Model

class Meta[source]

Bases: object

abstract = False
ordering = ['print_order', 'title']
description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

panels = [<FieldPanel 'title' with model=None>, <FieldPanel 'slug' with model=None>, <FieldPanel 'description' with model=None>, <FieldPanel 'print_order' with model=None>]
print_order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

search_fields = [<SearchField: title>, <AutocompleteField: title>, <FilterField: title>, <FilterField: id>, <FilterField: live>, <FilterField: owner>, <FilterField: content_type>, <FilterField: path>, <FilterField: depth>, <FilterField: locked>, <FilterField: show_in_menus>, <FilterField: first_published_at>, <FilterField: last_published_at>, <FilterField: latest_revision_created_at>, <FilterField: locale>, <FilterField: translation_key>, 'title__icontains', 'description__icontains', 'slug__icontains']
slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class eucrim.core.abstracts.AbstractPublicationPage(*args, **kwargs)[source]

Bases: BasePage

Base Page class. Currently used for ArticlePage and NewsPage.

class Meta[source]

Bases: object

abstract = False
ajax_template = None
property get_pdf_page_reference: PdfPageReference | None

Return a PdfPageReference with human-readable page numbering text and the corresponding anchor page in the PDF, or None if not applicable.

is_creatable = False
page_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

page_ptr_id
template = 'core/abstract_publication_page.html'
class eucrim.core.abstracts.BasePage(*args, **kwargs)[source]

Bases: Page

class Meta[source]

Bases: object

abstract = False
ajax_template = None
property get_og_description
property get_og_title
is_creatable = False
property og_image
page_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

page_ptr_id
template = 'core/base_page.html'
class eucrim.core.abstracts.CarouselItem(*args, **kwargs)[source]

Bases: LinkFields

class Meta[source]

Bases: object

abstract = False
caption

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

embed_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

image_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

panels = [<FieldPanel 'image' with model=None>, <FieldPanel 'embed_url' with model=None>, <FieldPanel 'caption' with model=None>, <MultiFieldPanel with model=None>]
class eucrim.core.abstracts.LinkFields(*args, **kwargs)[source]

Bases: Model

class Meta[source]

Bases: object

abstract = False

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

panels = [<FieldPanel 'link_external' with model=None>, <PageChooserPanel 'link_page' with model=None>, <FieldPanel 'link_document' with model=None>]
class eucrim.core.abstracts.PdfPageReference(text: str, anchor: int | None = None)[source]

Bases: object

PDF page numbering text and optional anchor (PDF page number).

anchor: int | None = None
text: str

Bases: LinkFields

class Meta[source]

Bases: object

abstract = False

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

panels = [<FieldPanel 'title' with model=None>, <MultiFieldPanel with model=None>]
title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

eucrim.core.apps module

class eucrim.core.apps.CoreConfig(app_name, app_module)[source]

Bases: AppConfig

name = 'eucrim.core'

eucrim.core.blocks module

class eucrim.core.blocks.AccordionContentBlock(*args, **kwargs)[source]

Bases: CommonContentBlock

base_blocks = {'authors_block': <eucrim.core.blocks.LatestAuthorsStaticBlock object>, 'block_quote': <eucrim.core.blocks.BlockQuote object>, 'calltoaction_block': <eucrim.core.blocks.CalltoactionBlock object>, 'citation_definitions': <wagtail.blocks.list_block.ListBlock object>, 'embed_block': <wagtail.embeds.blocks.EmbedBlock object>, 'figures': <eucrim.core.blocks.CountUpFiguresBlock object>, 'heading_block': <eucrim.core.blocks.HeadingBlock object>, 'image_block': <eucrim.core.blocks.ImageBlock object>, 'paragraph_block': <wagtail.blocks.field_block.RichTextBlock object>, 'publication_timeline': <eucrim.core.blocks.PublicationTimelineBlock object>, 'team_block': <eucrim.core.blocks.TeamBlock object>}
declared_blocks = {'citation_definitions': <wagtail.blocks.list_block.ListBlock object>}
class eucrim.core.blocks.AccordionItemBlock(*args, **kwargs)[source]

Bases: StructBlock

base_blocks = {'accordion_body': <eucrim.core.blocks.AccordionContentBlock object>, 'accordion_title': <wagtail.blocks.field_block.CharBlock object>}
declared_blocks = {'accordion_body': <eucrim.core.blocks.AccordionContentBlock object>, 'accordion_title': <wagtail.blocks.field_block.CharBlock object>}
class eucrim.core.blocks.BaseStreamBlock(*args, **kwargs)[source]

Bases: CommonContentBlock

base_blocks = {'accordion': <eucrim.core.blocks.AccordionItemBlock object>, 'authors_block': <eucrim.core.blocks.LatestAuthorsStaticBlock object>, 'block_quote': <eucrim.core.blocks.BlockQuote object>, 'calltoaction_block': <eucrim.core.blocks.CalltoactionBlock object>, 'embed_block': <wagtail.embeds.blocks.EmbedBlock object>, 'figures': <eucrim.core.blocks.CountUpFiguresBlock object>, 'heading_block': <eucrim.core.blocks.HeadingBlock object>, 'image_block': <eucrim.core.blocks.ImageBlock object>, 'paragraph_block': <wagtail.blocks.field_block.RichTextBlock object>, 'publication_timeline': <eucrim.core.blocks.PublicationTimelineBlock object>, 'tabs': <wagtail.blocks.list_block.ListBlock object>, 'team_block': <eucrim.core.blocks.TeamBlock object>}
declared_blocks = {'accordion': <eucrim.core.blocks.AccordionItemBlock object>, 'tabs': <wagtail.blocks.list_block.ListBlock object>}
class eucrim.core.blocks.BlockQuote(*args, **kwargs)[source]

Bases: StructBlock

Custom StructBlock that allows the user to attribute a quote to the author

base_blocks = {'attribute_name': <wagtail.blocks.field_block.CharBlock object>, 'text': <wagtail.blocks.field_block.TextBlock object>}
declared_blocks = {'attribute_name': <wagtail.blocks.field_block.CharBlock object>, 'text': <wagtail.blocks.field_block.TextBlock object>}
class eucrim.core.blocks.CalltoactionBlock(*args, **kwargs)[source]

Bases: StructBlock

base_blocks = {'email_link': <wagtail.blocks.field_block.EmailBlock object>, 'external_link': <wagtail.blocks.field_block.URLBlock object>, 'headline': <wagtail.blocks.field_block.CharBlock object>, 'internal_link': <wagtail.blocks.field_block.PageChooserBlock object>, 'link_text': <wagtail.blocks.field_block.CharBlock object>, 'text': <wagtail.blocks.field_block.RichTextBlock object>}
clean(value)[source]

Validate value and return a cleaned version of it, or throw a ValidationError if validation fails. The thrown ValidationError instance will subsequently be passed to render() to display the error message; the ValidationError must therefore include all detail necessary to perform that rendering, such as identifying the specific child block(s) with errors, in the case of nested blocks. (It is suggested that you use the ‘params’ attribute for this; using error_list / error_dict is unreliable because Django tends to hack around with these when nested.)

declared_blocks = {'email_link': <wagtail.blocks.field_block.EmailBlock object>, 'external_link': <wagtail.blocks.field_block.URLBlock object>, 'headline': <wagtail.blocks.field_block.CharBlock object>, 'internal_link': <wagtail.blocks.field_block.PageChooserBlock object>, 'link_text': <wagtail.blocks.field_block.CharBlock object>, 'text': <wagtail.blocks.field_block.RichTextBlock object>}
get_context(value, parent_context=None)[source]

Return a dict of context variables (derived from the block value and combined with the parent_context) to be used as the template context when rendering this value through a template. See the usage example for more details.

class eucrim.core.blocks.CitationDefinitionBlock(*args, **kwargs)[source]

Bases: StructBlock

base_blocks = {'citation_definition': <wagtail.blocks.field_block.RichTextBlock object>, 'citation_example': <wagtail.blocks.field_block.RichTextBlock object>, 'intro': <wagtail.blocks.field_block.RichTextBlock object>}
declared_blocks = {'citation_definition': <wagtail.blocks.field_block.RichTextBlock object>, 'citation_example': <wagtail.blocks.field_block.RichTextBlock object>, 'intro': <wagtail.blocks.field_block.RichTextBlock object>}
class eucrim.core.blocks.CommonContentBlock(*args, **kwargs)[source]

Bases: StreamBlock

base_blocks = {'authors_block': <eucrim.core.blocks.LatestAuthorsStaticBlock object>, 'block_quote': <eucrim.core.blocks.BlockQuote object>, 'calltoaction_block': <eucrim.core.blocks.CalltoactionBlock object>, 'embed_block': <wagtail.embeds.blocks.EmbedBlock object>, 'figures': <eucrim.core.blocks.CountUpFiguresBlock object>, 'heading_block': <eucrim.core.blocks.HeadingBlock object>, 'image_block': <eucrim.core.blocks.ImageBlock object>, 'paragraph_block': <wagtail.blocks.field_block.RichTextBlock object>, 'publication_timeline': <eucrim.core.blocks.PublicationTimelineBlock object>, 'team_block': <eucrim.core.blocks.TeamBlock object>}
declared_blocks = {'authors_block': <eucrim.core.blocks.LatestAuthorsStaticBlock object>, 'block_quote': <eucrim.core.blocks.BlockQuote object>, 'calltoaction_block': <eucrim.core.blocks.CalltoactionBlock object>, 'embed_block': <wagtail.embeds.blocks.EmbedBlock object>, 'figures': <eucrim.core.blocks.CountUpFiguresBlock object>, 'heading_block': <eucrim.core.blocks.HeadingBlock object>, 'image_block': <eucrim.core.blocks.ImageBlock object>, 'paragraph_block': <wagtail.blocks.field_block.RichTextBlock object>, 'publication_timeline': <eucrim.core.blocks.PublicationTimelineBlock object>, 'team_block': <eucrim.core.blocks.TeamBlock object>}
class eucrim.core.blocks.CountUpFiguresBlock(*args, **kwargs)[source]

Bases: StructBlock

base_blocks = {'figures': <wagtail.blocks.list_block.ListBlock object>}
declared_blocks = {'figures': <wagtail.blocks.list_block.ListBlock object>}
get_context(value, parent_context=None)[source]

Return a dict of context variables (derived from the block value and combined with the parent_context) to be used as the template context when rendering this value through a template. See the usage example for more details.

class eucrim.core.blocks.FigureBlock(*args, **kwargs)[source]

Bases: StructBlock

base_blocks = {'label': <wagtail.blocks.field_block.CharBlock object>, 'number': <wagtail.blocks.field_block.CharBlock object>, 'number_source': <wagtail.blocks.field_block.ChoiceBlock object>}
declared_blocks = {'label': <wagtail.blocks.field_block.CharBlock object>, 'number': <wagtail.blocks.field_block.CharBlock object>, 'number_source': <wagtail.blocks.field_block.ChoiceBlock object>}
class eucrim.core.blocks.HeadingBlock(*args, **kwargs)[source]

Bases: StructBlock

Custom StructBlock that allows the user to select h2 - h4 sizes for headers

base_blocks = {'heading_text': <wagtail.blocks.field_block.CharBlock object>, 'size': <wagtail.blocks.field_block.ChoiceBlock object>}
declared_blocks = {'heading_text': <wagtail.blocks.field_block.CharBlock object>, 'size': <wagtail.blocks.field_block.ChoiceBlock object>}
class eucrim.core.blocks.ImageBlock(*args, **kwargs)[source]

Bases: StructBlock

Custom StructBlock for utilizing images with associated caption and attribution data

base_blocks = {'attribution': <wagtail.blocks.field_block.CharBlock object>, 'caption': <wagtail.blocks.field_block.CharBlock object>, 'image': <wagtail.images.blocks.ImageChooserBlock object>}
declared_blocks = {'attribution': <wagtail.blocks.field_block.CharBlock object>, 'caption': <wagtail.blocks.field_block.CharBlock object>, 'image': <wagtail.images.blocks.ImageChooserBlock object>}
class eucrim.core.blocks.LatestAuthorsStaticBlock(*args, **kwargs)[source]

Bases: StaticBlock

get_context(value, parent_context=None)[source]

Return a dict of context variables (derived from the block value and combined with the parent_context) to be used as the template context when rendering this value through a template. See the usage example for more details.

class eucrim.core.blocks.PublicationTimelineBlock(*args, **kwargs)[source]

Bases: StructBlock

Renders an interactive publication timeline chart (articles + news per month).

base_blocks = {'article_boost': <wagtail.blocks.field_block.CharBlock object>, 'display_mode': <wagtail.blocks.field_block.ChoiceBlock object>}
declared_blocks = {'article_boost': <wagtail.blocks.field_block.CharBlock object>, 'display_mode': <wagtail.blocks.field_block.ChoiceBlock object>}
get_context(value, parent_context=None)[source]

Return a dict of context variables (derived from the block value and combined with the parent_context) to be used as the template context when rendering this value through a template. See the usage example for more details.

class eucrim.core.blocks.TabBlock(*args, **kwargs)[source]

Bases: StructBlock

base_blocks = {'content': <wagtail.blocks.field_block.RichTextBlock object>, 'icon': <wagtail.blocks.field_block.CharBlock object>, 'language': <wagtail.blocks.field_block.ChoiceBlock object>, 'title': <wagtail.blocks.field_block.CharBlock object>}
declared_blocks = {'content': <wagtail.blocks.field_block.RichTextBlock object>, 'icon': <wagtail.blocks.field_block.CharBlock object>, 'language': <wagtail.blocks.field_block.ChoiceBlock object>, 'title': <wagtail.blocks.field_block.CharBlock object>}
class eucrim.core.blocks.TeamBlock(*args, **kwargs)[source]

Bases: StructBlock

base_blocks = {'headline': <wagtail.blocks.field_block.CharBlock object>, 'style': <wagtail.blocks.field_block.ChoiceBlock object>, 'team_roles': <wagtail.blocks.field_block.MultipleChoiceBlock object>}
declared_blocks = {'headline': <wagtail.blocks.field_block.CharBlock object>, 'style': <wagtail.blocks.field_block.ChoiceBlock object>, 'team_roles': <wagtail.blocks.field_block.MultipleChoiceBlock object>}
get_context(value, parent_context=None)[source]

Return a dict of context variables (derived from the block value and combined with the parent_context) to be used as the template context when rendering this value through a template. See the usage example for more details.

eucrim.core.blocks.build_publication_timeline(show_articles=True, show_news=True, article_boost=1)[source]

Build an interactive publication timeline chart showing ArticlePage and/or NewsPage publication counts grouped by month.

Args:

show_articles: Include articles trace if True. show_news: Include news trace if True. article_boost: Multiplier for article counts (only applied when both are shown).

eucrim.core.utils module

class eucrim.core.utils.Languages[source]

Bases: Countries

only = ['GB', 'FR', 'DE']
eucrim.core.utils.generate_cover_image(file_obj, name=None)[source]
eucrim.core.utils.get_or_create_collection(name)[source]
eucrim.core.utils.send_email(instance=None, page=None, mail_template=None, recipient_list=None, user=None)[source]

Sends a notification email to a user when her/his ProfilePage is created. TODO: refactor to use this function for different kind of emails

eucrim.core.wagtail_hooks module

class eucrim.core.wagtail_hooks.CategoryAreasCrimeViewSet(**kwargs)[source]

Bases: CategoryViewSet

model

alias of CategoryAreasCrime

class eucrim.core.wagtail_hooks.CategoryCooperationViewSet(**kwargs)[source]

Bases: CategoryViewSet

model

alias of CategoryCooperation

class eucrim.core.wagtail_hooks.CategoryFoundationViewSet(**kwargs)[source]

Bases: CategoryViewSet

model

alias of CategoryFoundation

class eucrim.core.wagtail_hooks.CategoryInstitutionViewSet(**kwargs)[source]

Bases: CategoryViewSet

model

alias of CategoryInstitution

class eucrim.core.wagtail_hooks.CategoryProceduralCriminalLawViewSet(**kwargs)[source]

Bases: CategoryViewSet

model

alias of CategoryProceduralCriminalLaw

class eucrim.core.wagtail_hooks.CategoryRegionViewSet(**kwargs)[source]

Bases: CategoryViewSet

model

alias of CategoryRegion

class eucrim.core.wagtail_hooks.CategoryViewSet(**kwargs)[source]

Bases: SnippetViewSet

list_display = ['title', 'print_order', 'description', <wagtail.admin.ui.tables.UpdatedAtColumn: _updated_at>]
ordering = ['print_order', 'title']

The default ordering to use for the index view. Can be a string or a list/tuple in the same format as Django’s ordering.

search_fields = ['title', 'description']
eucrim.core.wagtail_hooks.editor_js()[source]
eucrim.core.wagtail_hooks.global_admin_css()[source]
eucrim.core.wagtail_hooks.global_admin_js()[source]
eucrim.core.wagtail_hooks.register_custom_help_item()[source]
eucrim.core.wagtail_hooks.show_my_pages_only(pages, request)[source]

eucrim.core.widgets module

class eucrim.core.widgets.DropdownLinkWidget(attrs=None, choices=())[source]

Bases: LinkWidget

Extend to get a dropdown with links. To use your own template, overwrite the given one.

get_option_label(value, choices=())[source]
label = None
property media
option_string()[source]
render(name, value, attrs=None, renderer=None, choices=())[source]

Render the widget as an HTML string.

render_option(name, selected_choices, option_value, option_label)[source]
right = False
template = 'core/widgets/dropdown_link.html'

Module contents