news.models.abstract — Model interfaces¶
Provides abstract model interfaces that should be implemeted.
-
class
news.models.abstract.AbstractModel¶ Provides common model interface that should be implemented by backends.
-
id¶ (
int) Id or primary key of the model.alias of
NotImplementedError
-
-
class
news.models.abstract.AbstractSchedule¶ Provides schedule meta model interface that should be implemented by backends.
-
cycle¶ (
int) Schedule’s news update cycle in minutes.alias of
NotImplementedError
-
enabled¶ (
bool) Schedule activation status.alias of
NotImplementedError
-
get_state(celery)¶ Returns current celery task state of the schedule.
Parameters: celery ( Celery) – Celery instance running for news fetch tasks.
-
news_type¶ (
str) A type of news to fetch. This field is used when mapping a schedule to a desired reporter class to be used fetching process.alias of
NotImplementedError
-
options¶ (
dict) Schedule’s options for reporters.alias of
NotImplementedError
-
owner¶ (
AbstractModelimplementation) Owner of the schedule.alias of
NotImplementedError
-
url¶ (
str) Url of the schedule.alias of
NotImplementedError
-
-
class
news.models.abstract.AbstractNews¶ Provides news model interface that should be implemented by backends. It also contains some default implementations for derivative properties.
(
str) Author of the news.alias of
NotImplementedError
-
content¶ (
str) Full content of the news.alias of
NotImplementedError
-
classmethod
create_instance(url, schedule, title, content, summary, published=None, parent=None, author=None, image=None)¶ Provides common interface to create models and abstracts different behaviours of model constructors away from various types of orms.
Parameters: - url (
str) – Url of the news. - schedule (
AbstractScheduleimplementation) – Schedule that fetched the news. - title (
str) – Title of the news. - content (
str) – Content of the news. - summary (
str) – Summary of the news. - published (
datetime) – Published datetime of the news. - parent (
AbstractNewsimplementation) – Parent news of the news. - author (
str) – Name of the news’s author - image (
str) – URL to the news’s image
Returns: Should return instance of a News fetched by a reporter.
Return type: AbstractNewsimplementation- url (
-
created¶ (
datetime.datetime) Created datetime of the news.alias of
NotImplementedError
-
distance¶ (
int) Distance from the root news.
-
image¶ (
str) Image of the news.alias of
NotImplementedError
-
is_root¶ (
bool) Returns True if the news is root news.
-
owner¶ (
AbstractModelimplementation) Owner of the news.
-
parent¶ (
news.models.abstract.AbstractNewsimplementation) Parent news from which the url of the news has been found.alias of
NotImplementedError
-
published¶ (
datetime.datetime) Published datetime of the news.alias of
NotImplementedError
-
root¶ (
AbstractNewsimplementation) Root news of the news.
-
schedule¶ (
news.models.abstract.AbstractScheduleimplementation) Schedule that the news belongs to.alias of
NotImplementedError
-
summary¶ (
str) Summary of the news.alias of
NotImplementedError
-
title¶ (
str) Title of the news.alias of
NotImplementedError
-
updated¶ (
datetime.datetime) Updated datetime of the news.alias of
NotImplementedError
-
url¶ (
str) Url of the news.alias of
NotImplementedError