Ikhaya Models
inyoka.ikhaya.models
Database models for Ikhaya.
- copyright:
2007-2024 by the Inyoka Team, see AUTHORS for more details.
- license:
BSD, see LICENSE for more details.
- class inyoka.ikhaya.models.Article(id, pub_date, pub_time, updated, author, subject, category, icon, intro, text, public, slug, is_xhtml, comment_count, comments_enabled)
- exception DoesNotExist
- exception MultipleObjectsReturned
- _meta = <Options for Article>
- property article_icon
- author
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 aForwardManyToOneDescriptor
instance.
- author_id
- category
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 aForwardManyToOneDescriptor
instance.
- category_id
- comment_count
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- comment_set
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.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property comments
This returns all the comments for this article
- comments_enabled
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- delete()
Subscriptions are removed by a Django signal pre_delete
- get_absolute_url(action='show', **query)
- get_intro()
- static get_intro_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
- get_next_by_pub_date(*, field=<django.db.models.fields.DateField: pub_date>, is_next=True, **kwargs)
- get_previous_by_pub_date(*, field=<django.db.models.fields.DateField: pub_date>, is_next=False, **kwargs)
- get_text()
- static get_text_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
This returns a boolean whether this article is not visible for normal users. Article that are not published or whose pub_date is in the future aren’t shown for a normal user.
- icon
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 aForwardManyToOneDescriptor
instance.
- icon_id
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- intro
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property intro_rendered
Renders the content of the field.
- is_intro_in_cache()
- is_text_in_cache()
- is_xhtml
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property local_pub_datetime
- property local_updated
- lock_key_base = 'ikhaya/article_lock'
Must be defined by an inherited model.
- objects = <inyoka.ikhaya.models.ArticleManager object>
- pub_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- pub_datetime
- pub_time
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- public
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- published = <inyoka.ikhaya.models.ArticleManager object>
- remove_intro_from_cache()
- remove_text_from_cache()
- report_set
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.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- save(*args, **kwargs)
This increases the edit count by 1.
- slug
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property stamp
Return the year/month/day part of an article url
- subject
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- text
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property text_rendered
Renders the content of the field.
- updated
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class inyoka.ikhaya.models.ArticleManager(*args, **kwargs)
- get_cached(keys)
Get some articles from the cache. keys must be a list with (pub_date, slug) pairs. Missing entries from the cache are automatically fetched from the database. This method should be also used for retrieving single objects.
- get_latest_articles(category=None, count=10)
Return count lastest articles for the category category or for all categories if None.
- get_queryset()
Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.
- class inyoka.ikhaya.models.Category(id, name, slug, icon)
- exception DoesNotExist
- exception MultipleObjectsReturned
- _meta = <Options for Category>
- article_set
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.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_absolute_url(action='show')
- icon
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 aForwardManyToOneDescriptor
instance.
- icon_id
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>
- 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.
- slug
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class inyoka.ikhaya.models.Comment(id, article, text, author, pub_date, deleted)
- exception DoesNotExist
- exception MultipleObjectsReturned
- _meta = <Options for Comment>
- article
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 aForwardManyToOneDescriptor
instance.
- article_id
- author
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 aForwardManyToOneDescriptor
instance.
- author_id
- deleted
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_absolute_url(action='show')
- get_next_by_pub_date(*, field=<django.db.models.fields.DateTimeField: pub_date>, is_next=True, **kwargs)
- get_previous_by_pub_date(*, field=<django.db.models.fields.DateTimeField: pub_date>, is_next=False, **kwargs)
- static get_text_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_text_in_cache()
- objects = <inyoka.ikhaya.models.CommentManager object>
- property position
Returns the position/index of this comment below an article
- pub_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- remove_text_from_cache()
- 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.
- text
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property text_rendered
Renders the content of the field.
- class inyoka.ikhaya.models.CommentManager(*args, **kwargs)
- get_latest_comments(article=None, count=10)
- class inyoka.ikhaya.models.Event(id, name, slug, changed, created, date, time, enddate, endtime, description, author, location, location_town, location_lat, location_long, visible)
- exception DoesNotExist
- exception MultipleObjectsReturned
- _construct_datetimes(day, time)
- _meta = <Options for Event>
- author
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 aForwardManyToOneDescriptor
instance.
- author_id
- changed
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property coordinates_url: str | None
Create a link to openstreetmap that shows details to a provided location
- created
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property description_rendered
Renders the content of the field.
- enddate
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property enddatetime
- endtime
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- friendly_title(with_html_link=False)
- get_absolute_url(action='show')
- static get_description_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
- get_next_by_changed(*, field=<django.db.models.fields.DateTimeField: changed>, is_next=True, **kwargs)
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)
- get_next_by_date(*, field=<django.db.models.fields.DateField: date>, is_next=True, **kwargs)
- get_previous_by_changed(*, field=<django.db.models.fields.DateTimeField: changed>, is_next=False, **kwargs)
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)
- get_previous_by_date(*, field=<django.db.models.fields.DateField: date>, 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_description_in_cache()
- location
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- location_lat
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- location_long
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- location_town
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property natural_coordinates
- objects = <inyoka.ikhaya.models.EventManager object>
- remove_description_from_cache()
- 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.
- property simple_coordinates
- slug
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property startdatetime
- time
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- visible
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class inyoka.ikhaya.models.Report(id, article, text, author, pub_date, deleted, solved)
- exception DoesNotExist
- exception MultipleObjectsReturned
- _meta = <Options for Report>
- article
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 aForwardManyToOneDescriptor
instance.
- article_id
- author
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 aForwardManyToOneDescriptor
instance.
- author_id
- deleted
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_absolute_url(action='show')
- get_next_by_pub_date(*, field=<django.db.models.fields.DateTimeField: pub_date>, is_next=True, **kwargs)
- get_previous_by_pub_date(*, field=<django.db.models.fields.DateTimeField: pub_date>, is_next=False, **kwargs)
- static get_text_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_text_in_cache()
- objects = <django.db.models.manager.Manager object>
- pub_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- remove_text_from_cache()
- solved
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- text
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property text_rendered
Renders the content of the field.
- class inyoka.ikhaya.models.Suggestion(id, author, pub_date, title, text, intro, notes, owner)
- exception DoesNotExist
- exception MultipleObjectsReturned
- _meta = <Options for Suggestion>
- author
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 aForwardManyToOneDescriptor
instance.
- author_id
- get_absolute_url()
- static get_intro_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
- get_next_by_pub_date(*, field=<django.db.models.fields.DateTimeField: pub_date>, is_next=True, **kwargs)
- static get_notes_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
- get_previous_by_pub_date(*, field=<django.db.models.fields.DateTimeField: pub_date>, is_next=False, **kwargs)
- static get_text_rendered(text, context=None)
Renders a specific text with the configuration of this field.
This is needed to render text that is not in the database (for example the preview).
The argument context has to be a RenderContext object or a dictonary containing additional keywordarguments to generate the RenderContext object.
This method is bound to the django models as staticmethod, so it can also be called from the Model and not only from the instance.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- intro
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property intro_rendered
Renders the content of the field.
- is_intro_in_cache()
- is_notes_in_cache()
- is_text_in_cache()
- notes
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property notes_rendered
Renders the content of the field.
- objects = <inyoka.ikhaya.models.SuggestionManager object>
- owner
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 aForwardManyToOneDescriptor
instance.
- owner_id
- pub_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- remove_intro_from_cache()
- remove_notes_from_cache()
- remove_text_from_cache()
- text
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property text_rendered
Renders the content of the field.
- title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class inyoka.ikhaya.models.SuggestionManager(*args, **kwargs)
- delete(ids)
Deletes a list of suggestions with only one query and refresh the caches.
- inyoka.ikhaya.models._get_not_cached_articles(keys, cache_values)
Return a tuple of (dates, slugs) for all keys in cache_values that are None