useful_inkleby.useful_django.models package¶
Submodules¶
useful_inkleby.useful_django.models.flexi module¶
FlexiModel tidies up adding up methods to models and querysets.
-
class
useful_inkleby.useful_django.models.flexi.ApplyManagerMethodMeta[source]¶ Bases:
django.db.models.base.ModelBaseCustomise the metaclass to apply a decorator that allows custom manager and queryset methods
-
class
useful_inkleby.useful_django.models.flexi.CustomRootManager[source]¶ Bases:
django.db.models.manager.Manager
-
class
useful_inkleby.useful_django.models.flexi.FlexiModel(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelClass for models to inherit to receive correct metaclass that allows the floating decorators
use instead of models.Model
-
useful_inkleby.useful_django.models.flexi.allow_floating_methods(cls)[source]¶ Decorator for models that allows functions to be transposed to querysets and managers can decorate models directly - or make a subclass of FlexiModel.
-
useful_inkleby.useful_django.models.flexi.managermethod(func)[source]¶ Decorator for a model method to make it a manager method instead.
will be accessible as model.objects.foo()
“self” will then be the manager object.
self.model - can then be used to access model. self.get_queryset() - to get access to a query
useful_inkleby.useful_django.models.mixins module¶
-
class
useful_inkleby.useful_django.models.mixins.EasyBulkModel(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelBulk Creation Mixin
Mixin to help with creation of large numbers of models with streamlined syntax.
-
batch_id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
batch_time¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
Module contents¶
-
class
useful_inkleby.useful_django.models.FlexiBulkModel(*args, **kwargs)[source]¶ Bases:
useful_inkleby.useful_django.models.flexi.FlexiModel,useful_inkleby.useful_django.models.mixins.EasyBulkModel,useful_inkleby.useful_django.models.mixins.StockModelHelpers