feeds.models – feeds models

class feeds.models.Category(*args, **kwargs)

Bases: django.db.models.base.Model

Category model to be used for categorization of content. Categories are high level constructs to be used for grouping and organizing content, thus creating a site’s table of contents.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class feeds.models.Enclosure(*args, **kwargs)

Bases: django.db.models.base.Model

potential enclosure of a feeds.models.Post

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

enclosure_type

type of the enclosed file, for example ‘image/jpeg’.

href

the url of the enclosed media file.

length

length of the enclosed media file in byte.

post

reference to the post the enclosure belongs to.

class feeds.models.Feed(*args, **kwargs)

Bases: django.db.models.base.Model

Model that contains information about any feed, including:

  • metadata for processing
  • results from social updates
  • calculated values

Coming from feedparser:

  • bozo
  • bozo_exception
  • encoding
  • etag
  • feed.author
  • feed.author_detail
  • feed.cloud
  • feed.contributors
  • feed.docs
  • feed.errorreportsto
  • feed.generator
  • feed.generator_detail
  • feed.icon
  • feed.id
  • feed.image
  • feed.info
  • feed.info_detail
  • feed.language
  • feed.license
  • feed.link
  • feed.links
  • feed.logo
  • feed.published
  • feed.published_parsed
  • feed.publisher
  • feed.publisher_detail
  • feed.rights
  • feed.rights_detail
  • feed.subtitle
  • feed.subtitle_detail
  • feed.tags
  • feed.textinput
  • feed.title
  • feed.title_detail
  • feed.ttl
  • feed.updated
  • feed.updated_parsed
  • headers
  • href
  • modified
  • namespaces
  • status
  • version
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

announce_posts

Whether to socially announce new articles posts

fromFeedparser(entry, postdict)

Create Posts from feedparser.

Args:

entry (dict): postdict (dict):

entry can have these keys: - ‘summary_detail’ - ‘published’ - ‘published_parsed’ - ‘links’ - ‘title’ - ‘tags’ - ‘summary’ - ‘content’ - ‘guidislink’ - ‘title_detail’ - ‘link’ - ‘id’

returnvalue::
Either ENTRY_NEW, ENTRY_UPDATE
get_absolute_url()

Absolute URL for this object.

Todo

should use ‘slug’ instead of ‘id’

ignore_ca

Do (not) verify certificate authenticity.

parse()

Wrap feedparser.parse.

Wrap feedparser.parse to handle all exceptions.

post_count()

Count Posts.

Return the number of posts in this feed.

refresh(force=False)

Refresh Feed.

Fetch posts for this feed, considering all we know about that source. We Ratelimit refreshing feeds.

Args:
force (boolean): Overrule rate limits.
Returns:
enum: The resulting status of refreshing this feed.
save(*args, **kwargs)

Save.

Override default save method to enforce failure count update.

subscriber_count()

Count Subscribers.

Return the number of subscribers for this feed.

update(parsed)

Feed.update.

Update feed with values retrieved from feedparser through parsed.

class feeds.models.FeedStats(*args, **kwargs)

Bases: django.db.models.base.Model

These are stats for all feeds.models.Feed in the list.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class feeds.models.FeedEntryStats(*args, **kwargs)

Bases: django.db.models.base.Model

These are stats for one particulat feeds.models.Feed in the list.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class feeds.models.FeedPostCount(id, feed, entry_new, entry_updated, entry_same, entry_err, created)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

save(*args, **kwargs)

# Now (Epoch time), rounded to full seconds (hence the cast) # subtract the modulo of 3600, result is the floor hour

class feeds.models.Options(id, user, number_initially_displayed, number_additionally_displayed, max_entries_saved)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class feeds.models.Post(*args, **kwargs)

Bases: django.db.models.base.Model

Model to hold an actual feed entry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

get_absolute_url()

return the absolute url for this Post.

get_trackable_url()

Get an URL for this particular object, that will be tracked in a separate view.

The related view is feeds.views.PostTrackableView

The view redirects to feeds.models.Post.link, storing information about the requesting client in feeds.models.PostReadCount

save(*args, **kwargs)

sanity check the post before saving.

score

Todo

implement this depending on :py:feeds.models.rating

class feeds.models.PostReadCount(*args, **kwargs)

Bases: django.db.models.base.Model

This is not a real counter, more a log.

Need to count and cleanup elsewhere.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class feeds.models.Rating(id, post, updated, tweets, blogs, plus1, likes, linkedin, shares, pageviews, sentiment, score)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class feeds.models.Subscription(*args, **kwargs)

Bases: django.db.models.base.Model

User Feed Subscription

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class feeds.models.Tag(*args, **kwargs)

Bases: django.db.models.base.Model

A tag.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

name

The name of the Tag.

objects = <feeds.managers.tag.TagManager object>

Overwrite the inherited manager with the custom feeds.models.TagManager

relevant

Indicates whether this Tag is relevant for further processing. It should be used to allow administrative intervention.

slug

The slug of the Tag. It can be used in any URL referencing this particular Tag.

touched

Keep track of when this Tag was last used.

class feeds.models.TaggedPost(*args, **kwargs)

Bases: django.db.models.base.Model

Holds the relationship between a tag and the item being tagged.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class feeds.models.WebSite(id, name, scheme, netloc, path, params, query, fragment, slug, commercial)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

commercial

Indicate, whether this is a commercial site.

feedcount()

return count of all feeds for this :WebSite:.

get_absolute_url()

Absolute URL for this object.

Todo

should use ‘slug’ instead of ‘id’

name

Name of the website.

objects = <feeds.managers.website.WebSiteManager object>

Overwrite the inherited manager with the custom feeds.models.WebSiteManager

save(*args, **kwargs)

Since ‘slug’ is not a required field for userinput, set it before saving.

Todo

This is a bit of magic, that should rather not happen. It strips http:// https:// and www, if present.

slug

Human readble URL component