Models

evileg_core.models module

Module which contains abstract models for fast development of web-site content. It includes classes for creating content and moderation of this content

class evileg_core.models.EAbstractActivity(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Class for creating different activities like subscriptions, bookmarks, likes dislikes and so on

Parameters
  • user – User which creates made this action

  • content_type – Django has ContentType model in which stores all types of Models of your web-site.

  • object_id – ID of object in some table on your web-site

  • content_object – parameter via which you can access to object

class Meta[source]

Bases: object

abstract = False
content_object

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

content_type

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.

content_type_id
get_self()[source]

This method return object, which has view representation for rendering in template. Activity object has Foreign key to Post object, and will return Post object instead of self.

Returns

object

invalidate_cache()[source]
object_id

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

objects
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.parent is a ForwardManyToOneDescriptor instance.

user_id
class evileg_core.models.EAbstractArticle(*args, **kwargs)[source]

Bases: evileg_core.models.EAbstractPost

Class for articles or similar content

Parameters

title – Title of your article

class Meta[source]

Bases: object

abstract = False
editable()[source]
get_title()[source]
lookup_fields = ('content', 'title')
slug

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

title

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

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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractArticleWithInterface(*args, **kwargs)[source]

Bases: evileg_core.models.EAbstractArticle, evileg_core.mixins.EInterfaceMixin

This class is the EAbstractArticle with template interface

class Meta[source]

Bases: object

abstract = False
get_meta_description()[source]
get_preview(*args, **kwargs)[source]
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractModeratedArticle(*args, **kwargs)[source]

Bases: evileg_core.models.EModerationMixin, evileg_core.models.EAbstractArticle

This class is the EAbstractArticle with moderation opportunity

class Meta[source]

Bases: object

abstract = False
get_moderation_display(*, field=<django.db.models.fields.CharField: moderation>)
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractModeratedArticleWithInterface(*args, **kwargs)[source]

Bases: evileg_core.models.EModerationMixin, evileg_core.models.EAbstractArticleWithInterface

This class is the EAbstractArticle wtemplate interface and moderation opportunity

class Meta[source]

Bases: object

abstract = False
get_moderation_display(*, field=<django.db.models.fields.CharField: moderation>)
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractModeratedPost(*args, **kwargs)[source]

Bases: evileg_core.models.EModerationMixin, evileg_core.models.EAbstractPost

This class is the EAbstractPost with moderation opportunity

class Meta[source]

Bases: object

abstract = False
get_moderation_display(*, field=<django.db.models.fields.CharField: moderation>)
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractModeratedPostWithInterface(*args, **kwargs)[source]

Bases: evileg_core.models.EModerationMixin, evileg_core.models.EAbstractPostWithInterface

This class is the EAbstractPost with template interface and moderation opportunity

class Meta[source]

Bases: object

abstract = False
get_moderation_display(*, field=<django.db.models.fields.CharField: moderation>)
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractModeratedSection(*args, **kwargs)[source]

Bases: evileg_core.models.EModerationMixin, evileg_core.models.EAbstractSection

class Meta[source]

Bases: object

abstract = False
get_moderation_display(*, field=<django.db.models.fields.CharField: moderation>)
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractModeratedSectionWithInterface(*args, **kwargs)[source]

Bases: evileg_core.models.EModerationMixin, evileg_core.models.EAbstractSectionWithInterface

class Meta[source]

Bases: object

abstract = False
get_moderation_display(*, field=<django.db.models.fields.CharField: moderation>)
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractPost(*args, **kwargs)[source]

Bases: django.db.models.base.Model

This is base abstract class of content in the your social network. You can use this class for generating post, comments, messages and so on

Parameters
  • user – user of content, ForeignKey to settings.AUTH_USER_MODEL

  • content – content, html message, django.db.models.TextField

  • content_markdown – markdown content, which is editing by user

  • pub_date – publication date of content, django.db.models.DateTimeField

  • lastmod – last modification date, django.db.models.DateTimeField

  • lookup_fields – fields for search via EPostManager

  • related_lookup_fields – fields for search in related models via EPostManager

class Meta[source]

Bases: object

abstract = False
content

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

content_markdown

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

edit_url_name = None
editable()[source]
get_content()[source]
get_content_markdown()[source]
get_edit_url()[source]
get_self()[source]

This method return object, which has view representation for rendering in template. For example Activity object has Foreign key to Post object, and will return Post object instead of self.

Returns

object

get_title()[source]
lastmod

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

lookup_fields = ('content',)
objects
property parent
pub_date

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

related_lookup_fields = ()
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.parent is a ForwardManyToOneDescriptor instance.

user_id
was_edited()[source]
class evileg_core.models.EAbstractPostWithInterface(*args, **kwargs)[source]

Bases: evileg_core.models.EAbstractPost, evileg_core.mixins.EInterfaceMixin

This class is the EAbstractPost with template interface

class Meta[source]

Bases: object

abstract = False
get_meta_description()[source]
get_preview(*args, **kwargs)[source]
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractSection(*args, **kwargs)[source]

Bases: evileg_core.models.EAbstractArticle

class Meta[source]

Bases: object

abstract = False
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EAbstractSectionWithInterface(*args, **kwargs)[source]

Bases: evileg_core.models.EAbstractSection, evileg_core.mixins.EInterfaceMixin

class Meta[source]

Bases: object

abstract = False
get_meta_description()[source]
get_preview(*args, **kwargs)[source]
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.parent is a ForwardManyToOneDescriptor instance.

class evileg_core.models.EModerationMixin(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Moderation abstract mixin for content which should be moderated of web-site administration

Parameters
  • SPAM – mark content like spam (constant variable)

  • NOT_MODERATED – mark content like not yet moderated (constant variable)

  • POST_MODERATED – mark content like may be published with post moderation (constant variable)

  • MODERATED – mark content like moderated (constant variable)

  • MODERATION_CHOICES – choices of moderation status

  • moderation – variable which stores moderation status

MODERATED = 'M'
MODERATED_BY_VOLUNTEER = 'm'
MODERATION_CHOICES = (('S', 'SPAM'), ('N', 'Not Moderated'), ('P', 'Post Moderated'), ('M', 'Moderated'), ('s', 'Volunteer - SPAM'), ('m', 'Volunteer - Moderated'))
class Meta[source]

Bases: object

abstract = False
NOT_MODERATED = 'N'
POST_MODERATED = 'P'
SPAM = 'S'
SPAM_BY_VOLUNTEER = 's'
get_moderation_display(*, field=<django.db.models.fields.CharField: moderation>)
is_approved()[source]
is_spam()[source]
moderation

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