core.models.Correspondent module¶
Module with the Correspondent model class.
- core.models.Correspondent.logger = <Logger core.models.Correspondent (INFO)>¶
The logger instance for the module.
- class core.models.Correspondent.Correspondent(*args, **kwargs)[source]¶
Bases:
ExportModelOperationsMixin('correspondent'),DownloadMixin,URLMixin,FavoriteModelMixin,TimestampModelMixin,ModelDatabase model for the correspondent data found in a mail.
- BASENAME = 'correspondent'¶
- DELETE_NOTICE = 'This will only delete the record of this correspondent, not of its emails.'¶
- DELETE_NOTICE_PLURAL = 'This will only delete the records of these correspondents, not of their emails.'¶
- email_address¶
The mail address of the correspondent. Unique.
- email_name¶
The mailer name. Can be blank if none has been found.
- real_name¶
The real name. Can be blank if the user doesn’t set one.
- user¶
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.parentis aForwardManyToOneDescriptorinstance.
- list_id¶
The List-ID header of the mailinglist. Unique together with
correspondent.
- list_owner¶
The List-Owner header of the mailinglist. Can be blank.
- list_subscribe¶
The List-Subscribe header of the mailinglist. Can be blank.
- list_unsubscribe¶
The List-Unsubscribe header of the mailinglist. Can be blank.
- list_unsubscribe_post¶
The List-Unsubscribe-Post header of the mailinglist. Can be blank.
- list_post¶
The List-Post header of the mailinglist. Can be blank.
- list_help¶
The List-Help header of the mailinglist. Can be blank.
- list_archive¶
The List-Archive header of the mailinglist. Can be blank.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- _meta = <Options for Correspondent>¶
- correspondentemails¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- created¶
The datetime the model instance was created. Is set automatically.
- emails¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_favorite¶
Flags favorite accounts. False by default.
- objects = <django.db.models.manager.Manager object>¶
- updated¶
The datetime the model instance entry was last updated. Is set automatically.
- user_id¶
- __str__()[source]¶
Returns a string representation of the model data.
- Return type:
- Returns:
The string representation of the correspondent, using
email_address.
Sends this attachment to the Nextcloud server of its user.
Note
Nextcloud returns 201 on success.
- Raises:
RuntimeError – If the users Nextcloud URL is not or improperly set.
ConnectionError – If connecting to Nextcloud failed.
PermissionError – If authentication to Nextcloud failed.
ValueError – If uploading the file to Nextcloud resulted in a bad response.
- Return type:
- property is_mailinglist: bool¶
Whether the correspondent is a mailinglist.
- Returns:
Whether the correspondent has any list_ attributes.
- property list_unsubscribe_post_name: str¶
Gets the name of the list unsubscribe method from list_unsubscribe.
- Returns:
The name of the list unsubscribe method.
- property list_archive_href: str¶
Parses the href for subscribing to the correspondents list.
- Returns:
The correspondents subscribe hyperref. The empty string if list_unsubscribe is empty.
- property list_help_href: str¶
Parses the href for subscribing to the correspondents list.
- Returns:
The correspondents subscribe hyperref. The empty string if list_unsubscribe is empty.
- property list_post_href: str¶
Parses the href for subscribing to the correspondents list.
- Returns:
The correspondents subscribe hyperref. The empty string if list_unsubscribe is empty.
- property list_subscribe_href: str¶
Parses the href for subscribing to the correspondents list.
- Returns:
The correspondents subscribe hyperref. The empty string if list_unsubscribe is empty.
- property list_unsubscribe_href: str¶
Parses the href for unsubscribing from the correspondents list.
- Returns:
The correspondents unsubscribe hyperref. The empty string if list_unsubscribe is empty.
- property name: str¶
Gets the best available name for the correspondent, if necessary from the mailaddress.
- Returns:
The most accurate available name of the correspondent.
- classmethod create_from_correspondent_tuple(correspondent_tuple, user)[source]¶
Creates a
core.models.Correspondentfrom email header data.- Parameters:
- Return type:
- Returns:
The
core.models.Correspondentwith the data from the header. If the correspondent already exists in the db returns that version. None if there is no address incorrespondent_tuple.
- static queryset_as_file(queryset)[source]¶
Parse the correspondents in the queryset into a vcard object bytestream.
- Parameters:
queryset (
QuerySet) – The correspondent queryset to compile into a file.- Return type:
- Returns:
The vcard object bytestream.
- Raises:
Correspondent.DoesNotExist – If the
querysetis empty.