eucrim.issue package

Submodules

eucrim.issue.apps module

class eucrim.issue.apps.IssueConfig(app_name, app_module)[source]

Bases: AppConfig

name = 'eucrim.issue'

eucrim.issue.forms module

class eucrim.issue.forms.IssueForm(data=None, files=None, parent_page=None, subscription=None, *args, **kwargs)[source]

Bases: WagtailAdminPageForm

Override the standard WagtailAdminPageForm for custom validation that appears as a non-field error see: http://docs.wagtail.io/en/stable/advanced_topics/customisation/page_editing_interface.html#customising-generated-forms # noqa: E501

base_fields = {'comment_notifications': <django.forms.fields.BooleanField object>}
clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

declared_fields = {'comment_notifications': <django.forms.fields.BooleanField object>}
property media

Return all media required to render the widgets on this form.

save(commit=True)[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

eucrim.issue.models module

class eucrim.issue.models.IssueIndexPage(id, path, depth, numchild, translation_key, locale, latest_revision, live, has_unpublished_changes, first_published_at, last_published_at, live_revision, go_live_at, expire_at, expired, locked, locked_at, locked_by, title, draft_title, slug, content_type, url_path, owner, seo_title, show_in_menus, search_description, latest_revision_created_at, alias_of, page_ptr, intro, wordcloud_stopwords)[source]

Bases: RoutablePageMixin, Page

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: NotUpdated

ajax_template = None
content_panels = [<wagtail.models.panels.PanelPlaceholder object>, <FieldPanel 'intro' with model=None>]
get_context(request)[source]
index_entries

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example:

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

intro

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

is_creatable = True
issue_details(request, issue_pk)[source]

HTMX partial: article listing + wordcloud for a single issue.

property issues
max_count = 1
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
parent_page_types = ['core.HomePage']
promote_panels = [<MultiFieldPanel with model=None>]
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>, <SearchField: intro>]
settings_panels = [<wagtail.models.panels.PanelPlaceholder object>, <wagtail.models.panels.CommentPanelPlaceholder object>, <FieldPanel 'wordcloud_stopwords' with model=None>]
show_in_menus = True
subpage_types = ['IssuePage']
template = 'issue/issue_index_page.html'
wordcloud_stopwords

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

class eucrim.issue.models.IssuePage(id, path, depth, numchild, translation_key, locale, latest_revision, live, has_unpublished_changes, first_published_at, last_published_at, live_revision, go_live_at, expire_at, expired, locked, locked_at, locked_by, title, draft_title, slug, content_type, url_path, owner, seo_title, show_in_menus, search_description, latest_revision_created_at, alias_of, page_ptr, focus_en, focus_fr, focus_ge, year, issue_number, legacy_toc, pdf, cover_image, start_page_numbering_at)[source]

Bases: BasePage

exception DoesNotExist

Bases: ObjectDoesNotExist

ISSUE_NUMBER_CHOICES = ((1, '01'), (2, '02'), (3, '03'), (4, '04'))
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

YEAR_CHOICES = [(2029, 2029), (2028, 2028), (2027, 2027), (2026, 2026), (2025, 2025), (2024, 2024), (2023, 2023), (2022, 2022), (2021, 2021), (2020, 2020), (2019, 2019), (2018, 2018), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006)]
ajax_template = None
articles

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

base_form_class

alias of IssueForm

content_panels = [<MultiFieldPanel with model=None>, <FieldPanel 'pdf' with model=None>, <FieldPanel 'start_page_numbering_at' with model=None>, <FieldPanel 'legacy_toc' with model=None>]
cover_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.

cover_image_id
focus_en

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

focus_fr

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

focus_ge

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

full_clean(*args, **kwargs)[source]

Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.

property get_articles
get_issue_number_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: issue_number>)
property get_obj_og_description
property get_obj_og_image
property get_obj_og_title
property get_official_notation
property get_official_notation_w_volume
property get_volume

Calculate the volume number for a given year.

Parameters:
  • year – The year for which to calculate the volume.

  • start_year – The year the journal started (default is 2006).

Returns:

The volume number for the given year.

property get_wordcloud
get_year_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: year>)
index_entries

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example:

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

is_creatable = True
issue_number

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

legacy_toc

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

news

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

objects = <eucrim.issue.models.IssuePageManager object>
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
parent_page_types = ['issue.IssueIndexPage']
pdf

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
property pdf_file_size

Return size in bytes without leaving open handles.

promote_panels = [<MultiFieldPanel with model=None>]
public_objects = <eucrim.issue.models.PublicIssuePageManager object>
save(*args, **kwargs)[source]

Writes the page to the database, performing additional housekeeping tasks to ensure data integrity:

  • locale, draft_title and slug are set to default values if not provided, with slug being generated from the title with a suffix to ensure uniqueness within the parent page where necessary

  • The url_path field is set based on the slug and the parent page

  • If the slug has changed, the url_path of this page and all descendants is updated and a page_slug_changed signal is sent

New pages should be saved by passing the unsaved page instance to the add_child() or add_sibling() method of an existing page, which will correctly update the fields responsible for tracking the page’s location in the tree.

If clean=False is passed, the page is saved without validation. This is appropriate for updates that only change metadata such as latest_revision while keeping content and page location unchanged.

If clean=True is passed (the default), and the page has live=True set, the page is validated using full_clean() before saving.

If clean=True is passed, and the page has live=False set, only the title and slug fields are validated.

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>, <SearchField: focus_en>, <SearchField: focus_fr>, <SearchField: focus_ge>, <SearchField: legacy_toc>]
show_in_menus = False
start_page_numbering_at

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

subpage_types = []
template = 'issue/issue_page.html'
year

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

class eucrim.issue.models.IssuePageManager(*args, **kwargs)[source]

Bases: BasePageManagerFromPageQuerySet

Custom manager for Issue pages

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

class eucrim.issue.models.PublicIssuePageManager(*args, **kwargs)[source]

Bases: BasePageManagerFromPageQuerySet

Custom manager for Issue pages, only listing live/published issues

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

eucrim.issue.models.get_current_year()[source]
eucrim.issue.models.issue_pdf_path(instance, filename)[source]

eucrim.issue.storage module

eucrim.issue.utils module

class eucrim.issue.utils.PDFExtractResult(title_en, title_fr, title_ge, legacy_toc, error)

Bases: tuple

error

Alias for field number 4

legacy_toc

Alias for field number 3

title_en

Alias for field number 0

title_fr

Alias for field number 1

title_ge

Alias for field number 2

eucrim.issue.utils.canonical_issue_filename(issue_year, issue_number, filetype=None)[source]
eucrim.issue.utils.extract_focuses(contentfile)[source]

Extracts the focus titles of an issue. Expects an instance of a ContentFile

Sources for focuses (in that ordering): 1. pdf cover page (including toc) DISABLED 2. pdf metadata subject (no toc)

eucrim.issue.utils.extract_focuses_from_pdfcoverpage(contentfile)[source]
eucrim.issue.utils.extract_focuses_from_pdfmetadata(contentfile)[source]
eucrim.issue.utils.generate_wordcloud(contentfile, filename, custom_stopwords=None)[source]
eucrim.issue.utils.get_wordcloud_bitmap(instance)[source]
eucrim.issue.utils.get_wordcloud_dir()[source]

eucrim.issue.wagtail_hooks module

eucrim.issue.wagtail_hooks.before_issue_publish_page(request, page)[source]
eucrim.issue.wagtail_hooks.page_header_buttons(page, user, view_name, next_url=None)[source]
eucrim.issue.wagtail_hooks.register_export_issue_content_url()[source]
eucrim.issue.wagtail_hooks.register_viewset()[source]

Module contents