ginger.main package¶
Submodules¶
ginger.main.admin module¶
Preparations for Django admin panel.
ginger.main.crawler module¶
Feed crawlers. Used for polling new messages from the web feeds.
-
class
ginger.main.crawler.
Crawler
¶ Bases:
object
For polling messages, instantiate this class and call crawl().
-
__cleanhtml
(s, linktarget)¶ - Parameters
s (str) –
linktarget (str) –
- Return type
str
-
__garbage_collector
(feed, seen_msgs)¶ - Parameters
feed (ginger.main.models.Feed) –
seen_msgs (List[ginger.main.models.NewsMessage]) –
- Return type
str
-
__translatetag
(s, linktarget, tree)¶ - Parameters
s (str) –
linktarget (str) –
tree (List) –
- Return type
str
-
crawl
()¶ Polls all feeds for new messages and returns a report string (just interesting for diagnostics).
- Return type
str
-
re_attribute
= re.compile('[^A-Za-z]([A-Za-z]*)\\s*=\\s*((\'[^\']*\')|(\\"[^\\"]*\\"))')¶
-
re_elementname
= re.compile('[^A-Za-z]*([A-Za-z]*)[^A-Za-z]')¶
-
re_slashatbegin
= re.compile('<\\s*/')¶
-
re_slashatend
= re.compile('/\\s*>')¶
-
re_tag
= re.compile('<[^<>]*>')¶
-
ginger.main.messagefilter module¶
Message filters. Used for restricting the user’s message list by particular criteria.
-
class
ginger.main.messagefilter.
AllMessageFilter
¶ Bases:
ginger.main.messagefilter.MessageFilter
Matches all messages.
-
_abc_impl
= <_abc_data object>¶
-
_tonativerepresentation
()¶ Returns a serializable representation of the inner data of this filter.
-
applyfilter
(elements, user)¶ Returns a list of messages that are matched by this filter from the input list.
-
-
class
ginger.main.messagefilter.
AndMessageFilter
(filterstring)¶ Bases:
ginger.main.messagefilter.CombinationMessageFilter
Matches messages by an and-combination of other filters.
-
_abc_impl
= <_abc_data object>¶
-
applyfilter
(elements, user)¶ Returns a list of messages that are matched by this filter from the input list.
-
-
class
ginger.main.messagefilter.
CombinationMessageFilter
(filterstring)¶ Bases:
ginger.main.messagefilter.MessageFilter
,abc.ABC
Matches messages by a combination of other filters.
-
_abc_impl
= <_abc_data object>¶
-
_tonativerepresentation
()¶ Returns a serializable representation of the inner data of this filter.
-
-
class
ginger.main.messagefilter.
IdMessageFilter
(id)¶ Bases:
ginger.main.messagefilter.MessageFilter
Matches a message with a particular id.
- Parameters
id (Union[str, int]) –
-
_abc_impl
= <_abc_data object>¶
-
_tonativerepresentation
()¶ Returns a serializable representation of the inner data of this filter.
-
applyfilter
(elements, user)¶ Returns a list of messages that are matched by this filter from the input list.
-
class
ginger.main.messagefilter.
MessageFilter
¶ Bases:
abc.ABC
Base class for a message filter.
Different instances of different MessageFilter subclasses can be composed together for filter a message source.
-
_abc_impl
= <_abc_data object>¶
-
abstract
_tonativerepresentation
()¶ Returns a serializable representation of the inner data of this filter.
- Return type
List[Any]
-
abstract
applyfilter
(elements, user)¶ Returns a list of messages that are matched by this filter from the input list.
- Parameters
elements (Iterable[ginger.main.models.NewsMessage]) –
user (django.contrib.auth.models.User) –
- Return type
-
property
native_representation
¶ Returns a serializable representation for this filter.
-
-
class
ginger.main.messagefilter.
NotMessageFilter
(filterstring)¶ Bases:
ginger.main.messagefilter.MessageFilter
Matches messages by inverting another filter.
-
_abc_impl
= <_abc_data object>¶
-
_tonativerepresentation
()¶ Returns a serializable representation of the inner data of this filter.
-
applyfilter
(elements, user)¶ Returns a list of messages that are matched by this filter from the input list.
-
-
class
ginger.main.messagefilter.
OrMessageFilter
(filterstring)¶ Bases:
ginger.main.messagefilter.CombinationMessageFilter
Matches messages by an or-combination of other filters.
-
_abc_impl
= <_abc_data object>¶
-
applyfilter
(elements, user)¶ Returns a list of messages that are matched by this filter from the input list.
-
-
class
ginger.main.messagefilter.
TagMessageFilter
(tag)¶ Bases:
ginger.main.messagefilter.MessageFilter
Matches messages by tag.
-
_abc_impl
= <_abc_data object>¶
-
_tonativerepresentation
()¶ Returns a serializable representation of the inner data of this filter.
-
applyfilter
(elements, user)¶ Returns a list of messages that are matched by this filter from the input list.
-
applyfilternegated
(elements, user)¶
-
-
ginger.main.messagefilter.
filterbyfilterstring
(filterstring)¶ Creates a
MessageFilter
for a url-encoded filter string.- Parameters
filterstring (str) –
- Return type
ginger.main.models module¶
Models.
-
class
ginger.main.models.
Feed
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
A web feed.
See ginger.main.crawler for details about how messages are retrieved from feeds.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
_meta
= <Options for Feed>¶
-
correspondingTags
¶ 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
enabled
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_lastFetched
(*, field=<django.db.models.fields.DateTimeField: lastFetched>, is_next=True, **kwargs)¶
-
get_previous_by_lastFetched
(*, field=<django.db.models.fields.DateTimeField: lastFetched>, 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.
-
lastFetched
¶ 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.
-
newsmessage_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.
-
objects
= <django.db.models.manager.Manager 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
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
updateInterval
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
url
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
ginger.main.models.
NewsMessage
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
A message from a web feed.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
__addtag
(tag, *, firescript=True)¶ - Parameters
tag (Union[str, Tag]) –
firescript (bool) –
- Return type
- Return type
None
-
_meta
= <Options for NewsMessage>¶
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
delete_later
()¶ Marks a message as deleted.
- Return type
None
-
deleted
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
feed
¶ 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.
-
feed_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
fetchedAt
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
-
get_previous_by_created
(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
-
guid
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
id
¶ 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>¶
-
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
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
remove_tag
(tag)¶ Removes a tag from this message.
- Parameters
tag (str) –
- Return type
None
-
save
(*args, **kwargs)¶ Saves the Django model.
Also executes some
ginger.main.userscripting.execute_user_script()
.
-
seen
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Sets the list of tags for this message.
- Parameters
tags (Union[List[str], str]) –
- Return type
None
-
summary
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
Returns a list of tag names for a space separated string.
- Parameters
tags (str) –
- Return type
List[str]
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
url
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
ginger.main.models.
Tag
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
A tag. To be assigned to a Message.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
_meta
= <Options for Tag>¶
-
feed_set
¶ 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
static
formatted_name
(name)¶ Returns a formatted tag name, cleaned up from forbidden characters.
- Parameters
name (str) –
- Return type
str
-
static
generate_new_tag_name
(name, owner)¶ Returns a new tag with a name like the given one. If this tag already exists, it will create a new one with a similar name!
- Parameters
name (str) –
owner (django.contrib.auth.models.User) –
- Return type
-
static
get_tag_by_name
(name, owner)¶ Returns the Tag by name. If it does not yet exist internally, a new one is created.
- Parameters
name (str) –
owner (django.contrib.auth.models.User) –
- Return type
-
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.
-
newsmessage_set
¶ 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <django.db.models.manager.Manager 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
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tapplyalso
¶ 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
tif
¶ 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
ginger.main.models.
TagPropagationRule
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
A tag propagation rule.
Those rules are automatically processed in background whenever a tag is assigned to a message, and can lead to further tag assignments.
Whenever a message has all of iftags, it also gets all of applyalsotags assigned.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
_meta
= <Options for TagPropagationRule>¶
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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <django.db.models.manager.Manager 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
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
ginger.main.models.
UserConfiguration
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
One user configuration pair of a key and an associated value.
Can store arbitrary json-serializable objects.
Usually each pair is owned by a user. However, in a few cases the backend stores global stuff here as well (with user=None).
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
_meta
= <Options for UserConfiguration>¶
-
configkey
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
configvalue
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
static
get
(user, key, defaultvalue=None)¶ Returns a user configuration value for a user and key.
- Parameters
user (django.contrib.auth.models.User) –
key (str) –
defaultvalue (Optional[Any]) –
- Return type
Optional[Any]
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
static
list
(user)¶ Returns the list of all existing keys for a user.
- Parameters
user (django.contrib.auth.models.User) –
- Return type
List[str]
-
objects
= <django.db.models.manager.Manager object>¶
-
static
remove
(user, key)¶ Removes a user configuration value for a user and key.
- Parameters
user (django.contrib.auth.models.User) –
key (str) –
- Return type
bool
-
static
set
(user, key, value)¶ Sets a user configuration value for a user and key.
- Parameters
user (django.contrib.auth.models.User) –
key (str) –
value (Optional[Any]) –
- Return type
None
-
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 aForwardManyToOneDescriptor
instance.
-
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
ginger.main.projectinformations module¶
ginger.main.userscripting module¶
Helpers for user scripting.
-
ginger.main.userscripting.
execute_user_script
(user, scriptname, *args)¶ Executes a user script.
This is not always enabled and is a noop otherwise. See the documentation for more details.
- Parameters
user (django.contrib.auth.models) –
scriptname (str) –
args (Any) –
- Return type
None
-
ginger.main.userscripting.
is_execute_user_script_enabled
(user)¶ Returns whether backend side user scripting is available for a given user.
- Parameters
user (django.contrib.auth.models) –
- Return type
bool
ginger.main.views module¶
Django views.
Most of them are not actually views for user interface presentation but api implementation.
-
class
ginger.main.views.
AccountsActionLoginView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
post
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
AccountsActionLogoutView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
post
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
FeedView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
delete
(request, feedid)¶ - Parameters
request (django.http.request.HttpRequest) –
feedid (int) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
FeedsActionCrawlView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
post
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
FeedsView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
post
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
FilterView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
delete
(request, filtername)¶ - Parameters
request (django.http.request.HttpRequest) –
filtername (str) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
FiltersView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
post
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
IndexPageView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
LoginPageView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
MessageView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
delete
(request, msgid)¶ - Parameters
request (django.http.request.HttpRequest) –
msgid (int) –
- Return type
django.http.response.HttpResponse
-
patch
(request, msgid)¶ - Parameters
request (django.http.request.HttpRequest) –
msgid (int) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
MessagesView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
TagPropagationRuleView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
delete
(request, ruleid)¶ - Parameters
request (django.http.request.HttpRequest) –
ruleid (int) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
TagPropagationRulesView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
post
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
TagView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
delete
(request, tag)¶ - Parameters
request (django.http.request.HttpRequest) –
tag (str) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
TagsView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
UserConfigurationView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request, key)¶ - Parameters
request (django.http.request.HttpRequest) –
key (str) –
- Return type
django.http.response.HttpResponse
-
put
(request, key)¶ - Parameters
request (django.http.request.HttpRequest) –
key (str) –
- Return type
django.http.response.HttpResponse
-
-
class
ginger.main.views.
UserConfigurationsView
(**kwargs)¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get
(request)¶ - Parameters
request (django.http.request.HttpRequest) –
- Return type
django.http.response.HttpResponse
-
ginger.main.viewutils module¶
Some helping hands for ginger.main.views.
-
ginger.main.viewutils.
_get_default_admin_user
()¶ Finds or creates the default admin user.
- Return type
django.contrib.auth.models.User
-
ginger.main.viewutils.
ensure_ginger_initialized
()¶ Ensures that Ginger is initialized (e.g. a factory default admin user was created).
Does the initialization on first run. Returns True in this case.
- Return type
bool
-
ginger.main.viewutils.
login_required
(fct)¶ Decorator for requiring an authenticated user for a view method.
A user who visits such a view without being logged in will be forwarded to the login page and redirected back afterwards.
- Parameters
fct (Callable) –
- Return type
Callable
-
ginger.main.viewutils.
modellist_to_dictlist
(models)¶ Returns a list of serializable dicts for a list of native models.
- Parameters
models (List[django.db.models.base.Model]) –
- Return type
List[Dict]
-
ginger.main.viewutils.
render_template
(templatefile, *, request, templateargs=None, gingercontextargs=None)¶ Renders a template with some common data available in its context.
- Parameters
templatefile (str) –
request (django.http.request.HttpRequest) –
templateargs (Optional[Dict]) –
gingercontextargs (Optional[Dict]) –
- Return type
str
-
ginger.main.viewutils.
request_body_object
(request)¶ Deserializes the request body. Typically this is a dictionary of arguments.
- Parameters
request (django.http.request.HttpRequest) –
- Return type
Optional[Any]
Module contents¶
Ginger application.