Meringue core¤
This is a basic package that contains a variety of general purpose functionality such as abstract models, various handlers, utilities, and more.
Mixins¤
CMTimeMixin¤
A primitive abstract model that adds the ctime and mtime fields to your model.
SortingMixin¤
An abstract model that adds a sortable field, as well as a manager with sorting correction functionality.
correction_sorting¤
This is a method to update/fix the sorting of the selected list of items.
The sorting will be done according to the queryset
sorting, so sorting can be controlled
by executing .order_by()
before calling the correction_sorting
method.
The selection for updating sorting can be pre-limited by filtering the list.
PublicationMixin¤
published¤
Method to getting published items.
unpublished¤
Method for getting unpublished items.
PublicationDatesMixin¤
published¤
Method to getting published items.
unpublished¤
Method for getting unpublished items.
Utils¤
format_date_from_to¤
Method to display date period.
Possible output formats depending on the input data:
- DD.MM.YYYY - DD.MM.YYYY
- DD.MM - DD.MM.YYYY
- DD - DD.MM.YYYY
- DD.MM.YYYY
Examples:
Attributes:
-
date_start
–
Period start date.
-
date_end
–
Period end date.
-
delimiter
–
Dates delimiter.
Returns:
-
str
–Date period string.
Templatetags¤
cop_year¤
A tag that displays the year or range of years for the copyright string in YYYY-YYYY format.
For the tag to work, you must fill in the COP_YEAR
parameter in the settings.
Examples:
Raises:
-
Exception
–To use the
cop_year
tag, you must fill in theCOP_YEAR
parameter in the meringue settings
Returns:
-
str
–Year for copyrights.
date_range¤
return range of date in one of the following formats
DD.MM.YYYY - DD.MM.YYYY DD.MM - DD.MM.YYYY DD - DD.MM.YYYY DD.MM.YYYY
Attributes:
-
date_start
–
Period start date.
-
date_end
–
Period end date.
Examples:
Returns:
-
str
–Date period.
Translations¤
If you use djano-modeltranslation, then when connecting meringue.core
, you can register fields for translations by setting the list of fields in the m_translate_fields
field in the meta of the corresponding model:
class FooModel(models.Model):
name = models.CharField(max_length=32)
class Meta:
m_translate_fields = ["name", ]
Views¤
im_a_teapot¤
Created: 2023-06-24 12:29:38+0000