org.models.political_business ============================= .. py:module:: org.models.political_business Attributes ---------- .. autoapisummary:: org.models.political_business.PoliticalBusinessType org.models.political_business.POLITICAL_BUSINESS_TYPE org.models.political_business.POLITICAL_BUSINESS_STATUS Classes ------- .. autoapisummary:: org.models.political_business.PoliticalBusiness org.models.political_business.PoliticalBusinessParticipation org.models.political_business.PoliticalBusinessCollection org.models.political_business.PoliticalBusinessParticipationCollection Module Contents --------------- .. py:type:: PoliticalBusinessType :canonical: Literal['inquiry', 'proposal', 'mandate', 'report', 'report and proposal', 'decision', 'message', 'urgent interpellation', 'invitation', 'interpelleation', 'interpellation', 'commission report', 'communication', 'motion', 'postulate', 'resolution', 'regulation', 'miscellaneous', 'elections'] .. py:data:: POLITICAL_BUSINESS_TYPE :type: dict[PoliticalBusinessType, str] .. py:data:: POLITICAL_BUSINESS_STATUS :type: dict[PoliticalBusinessStatus, str] .. py:class:: PoliticalBusiness Bases: :py:obj:`onegov.org.models.extensions.AccessExtension`, :py:obj:`onegov.file.MultiAssociatedFiles`, :py:obj:`onegov.core.orm.Base`, :py:obj:`onegov.core.orm.mixins.ContentMixin`, :py:obj:`onegov.org.models.extensions.GeneralFileLinkExtension`, :py:obj:`onegov.search.ORMSearchable` Extends any class that has a meta dictionary field with the ability to set one of the following access levels: * 'public' - The default, the model is listed and accessible. * 'private' - Neither listed nor accessible, except administrators and editors. * 'member' - Neither listed nor accessible except administrators, editors and members. * 'secret' - Not listed, but available for anyone that knows the URL. * 'mtan' - The model is listed but only accessible once an mTAN has been sent to the person and entered correctly. * 'secret_mtan' - Not listed and only accessible once an mTAN has been sent to the person and entered correctly. see :func:`onegov.core.security.rules.has_permission_not_logged_in` .. py:attribute:: GERMAN_STATUS_NAME_TO_VALUE_MAP :type: dict[str, str] .. py:attribute:: __tablename__ :value: 'par_political_businesses' .. py:attribute:: es_type_name :value: 'ris_political_business' Returns the unique type name of the model. .. py:attribute:: es_public :value: True Returns True if the model is available to be found by the public. If false, only editors/admins will see this object in the search results. .. py:attribute:: es_properties Returns the type mapping of this model. Each property in the mapping will be read from the model instance. The returned object needs to be a dict or an object that provides a ``to_dict`` method. Internally, onegov.search stores differing languages in different indices. It does this automatically through langauge detection, or by manually specifying a language. Note that objects with multiple languages are not supported (each object is supposed to have exactly one language). Onegov.search will automatically insert the right analyzer for types like these. There's currently only limited support for properties here, namely objects and nested mappings do not work! This is going to be added in the future though. .. py:property:: es_suggestion :type: str Returns suggest-as-you-type value of the document. The field used for this property should also be indexed, or the suggestion will lead to nowhere. If a single string is returned, the completion input equals the completion output. (My Title -> My Title) If an array of strings is returned, all values are possible inputs and the first value is the output. (My Title/Title My -> My Title) .. py:attribute:: id :type: sqlalchemy.Column[uuid.UUID] .. py:attribute:: title :type: sqlalchemy.Column[str] .. py:attribute:: number :type: sqlalchemy.Column[str | None] .. py:attribute:: political_business_type :type: sqlalchemy.Column[PoliticalBusinessType] .. py:attribute:: status :type: sqlalchemy.Column[PoliticalBusinessStatus | None] .. py:attribute:: entry_date :type: sqlalchemy.Column[datetime.date | None] .. py:attribute:: participants :type: sqlalchemy.orm.relationship[list[PoliticalBusinessParticipation]] .. py:attribute:: parliamentary_group_id :type: sqlalchemy.Column[uuid.UUID | None] .. py:attribute:: parliamentary_group :type: sqlalchemy.orm.relationship[onegov.org.models.RISParliamentaryGroup | None] .. py:attribute:: meetings :type: sqlalchemy.orm.relationship[onegov.org.models.Meeting] .. py:attribute:: meeting_items :type: sqlalchemy.orm.relationship[list[onegov.org.models.MeetingItem]] .. py:method:: __repr__() -> str .. py:class:: PoliticalBusinessParticipation Bases: :py:obj:`onegov.core.orm.Base`, :py:obj:`onegov.core.orm.mixins.ContentMixin` A participant of a political business, e.g. a parliamentarian. .. py:attribute:: __tablename__ :value: 'par_political_business_participants' .. py:attribute:: id :type: sqlalchemy.Column[uuid.UUID] .. py:attribute:: political_business_id :type: sqlalchemy.Column[uuid.UUID] .. py:attribute:: parliamentarian_id :type: sqlalchemy.Column[uuid.UUID] .. py:attribute:: participant_type :type: sqlalchemy.Column[str | None] .. py:attribute:: political_business :type: sqlalchemy.orm.relationship[PoliticalBusiness] .. py:attribute:: parliamentarian :type: sqlalchemy.orm.relationship[onegov.org.models.RISParliamentarian] .. py:method:: __repr__() -> str .. py:class:: PoliticalBusinessCollection(session: sqlalchemy.orm.Session, page: int = 0) Bases: :py:obj:`onegov.core.collection.GenericCollection`\ [\ :py:obj:`PoliticalBusiness`\ ], :py:obj:`onegov.core.collection.Pagination`\ [\ :py:obj:`PoliticalBusiness`\ ] Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:attribute:: page :value: 0 .. py:attribute:: batch_size :value: 20 .. py:property:: model_class :type: type[PoliticalBusiness] .. py:method:: __eq__(other: object) -> bool Returns True if the current and the other Pagination instance are equal. Used to find the current page in a list of pages. .. py:method:: query() -> sqlalchemy.orm.Query[PoliticalBusiness] .. py:method:: subset() -> sqlalchemy.orm.Query[PoliticalBusiness] Returns an SQLAlchemy query containing all records that should be considered for pagination. .. py:method:: page_by_index(index: int) -> Self Returns the page at the given index. A page here means an instance of the class inheriting from the ``Pagination`` base class. .. py:property:: page_index :type: int Returns the current page index (starting at 0). .. py:class:: PoliticalBusinessParticipationCollection(session: sqlalchemy.orm.Session, active: bool | None = None) Bases: :py:obj:`onegov.core.collection.GenericCollection`\ [\ :py:obj:`PoliticalBusinessParticipation`\ ] Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:attribute:: active :value: None .. py:property:: model_class :type: type[PoliticalBusinessParticipation]