Date-based mixinsLink para este cabeçalho

YearMixinLink para este cabeçalho

class YearMixinLink para esta definição

Um mixin que pode ser usado para obter e fornecer informações de análise do componente ano de uma data.

Métodos e Atributos

year_formatLink para esta definição

The strftime() format to use when parsing the year. By default, this is '%Y'.

yearLink para esta definição

Optional The value for the year, as a string. By default, set to None, which means the year will be determined using other means.

get_year_format()Link para esta definição

Returns the strftime() format to use when parsing the year. Returns year_format by default.

get_year()Link para esta definição

Retorna o ano para o qual essa view mostrará dado como uma string. Tenta as seguintes fontes, na ordem:

  • O valor do atributo YearMixin.year.

  • O valor do parâmetro year capturado pelo padrão da URL.

  • The value of the year GET query argument.

Raises a 404 if no valid year specification can be found.

get_next_year(date)Link para esta definição

Returns a date object containing the first day of the year after the date provided. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

get_previous_year(date)Link para esta definição

Returns a date object containing the first day of the year before the date provided. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

MonthMixinLink para este cabeçalho

class MonthMixinLink para esta definição

A “mixin” que pode ser usada para recuperar e fornecer informações de análise por um componente mês de uma data.

Métodos e Atributos

month_formatLink para esta definição

The strftime() format to use when parsing the month. By default, this is '%b'.

monthLink para esta definição

Optional The value for the month, as a string. By default, set to None, which means the month will be determined using other means.

get_month_format()Link para esta definição

Returns the strftime() format to use when parsing the month. Returns month_format by default.

get_month()Link para esta definição

Returns the month for which this view will display data, as a string. Tries the following sources, in order:

  • O valor do atributo MonthMixin.month.

  • O valor do argumento “mês” capturado na URL, com base em um padrão.

  • The value of the month GET query argument.

Retornará um erro 404 se nenhuma especificação de mês for localizada.

get_next_month(date)Link para esta definição

Retorna um objeto do tipo data que contém o primeiro dia do mês após a data informada. Esta função pode também retornar “None” ou provocar uma excessão do tipo: class:~django.http.Http404, dependendo dos valores de allow_empty e allow_future.

get_previous_month(date)Link para esta definição

Returns a date object containing the first day of the month before the date provided. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

DayMixinLink para este cabeçalho

class DayMixinLink para esta definição

A mixin that can be used to retrieve and provide parsing information for a day component of a date.

Métodos e Atributos

day_formatLink para esta definição

The strftime() format to use when parsing the day. By default, this is '%d'.

dayLink para esta definição

Optional The value for the day, as a string. By default, set to None, which means the day will be determined using other means.

get_day_format()Link para esta definição

Returns the strftime() format to use when parsing the day. Returns day_format by default.

get_day()Link para esta definição

Retorna o dia pra o qual essa view mostrará o dado como uma string. Tenta as seguintes fontes, na ordem:

  • O valor do atributo DayMixin.day.

  • O valor do argumento day capturado no padrão de URL

  • O valor do parâmetro day via GET query.

Retorna um erro 404 se nenhuma especificação de dia válido for localizado.

get_next_day(date)Link para esta definição

Returns a date object containing the next valid day after the date provided. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

get_previous_day(date)Link para esta definição

Returns a date object containing the previous valid day. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

WeekMixinLink para este cabeçalho

class WeekMixinLink para esta definição

Um “mixin” que pode ser utilizado para recuperar e forneceder informações de análise para um componente de semana de uma data.

Métodos e Atributos

week_formatLink para esta definição

The strftime() format to use when parsing the week. By default, this is '%U', which means the week starts on Sunday. Set it to '%W' or '%V' (ISO 8601 week) if your week starts on Monday.

weekLink para esta definição

Optional The value for the week, as a string. By default, set to None, which means the week will be determined using other means.

get_week_format()Link para esta definição

Returns the strftime() format to use when parsing the week. Returns week_format by default.

get_week()Link para esta definição

Returns the week for which this view will display data, as a string. Tries the following sources, in order:

  • O valor do atributo WeekMixin.week.

  • O valor do parâmetro week capturado pelo padrão da URL

  • O valor do parâmetro week via GET query.

Retorna um erro 404 se nenhuma especificação de semana válida for localizada.

get_next_week(date)Link para esta definição

Returns a date object containing the first day of the week after the date provided. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

get_prev_week(date)Link para esta definição

Returns a date object containing the first day of the week before the date provided. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

DateMixinLink para este cabeçalho

class DateMixinLink para esta definição

A mixin class providing common behavior for all date-based views.

Métodos e Atributos

date_fieldLink para esta definição

The name of the DateField or DateTimeField in the QuerySet’s model that the date-based archive should use to determine the list of objects to display on the page.

When time zone support is enabled and date_field is a DateTimeField, dates are assumed to be in the current time zone. Otherwise, the queryset could include objects from the previous or the next day in the end user’s time zone.

allow_futureLink para esta definição

A boolean specifying whether to include “future” objects on this page, where “future” means objects in which the field specified in date_field is greater than the current date/time. By default, this is False.

get_date_field()Link para esta definição

Returns the name of the field that contains the date data that this view will operate on. Returns date_field by default.

get_allow_future()Link para esta definição

Determine whether to include “future” objects on this page, where “future” means objects in which the field specified in date_field is greater than the current date/time. Returns allow_future by default.

BaseDateListViewLink para este cabeçalho

class BaseDateListViewLink para esta definição

A base class that provides common behavior for all date-based views. There won’t normally be a reason to instantiate BaseDateListView; instantiate one of the subclasses instead.

While this view (and its subclasses) are executing, self.object_list will contain the list of objects that the view is operating upon, and self.date_list will contain the list of dates for which data is available.

Mixins

Métodos e Atributos

allow_emptyLink para esta definição

A boolean specifying whether to display the page if no objects are available. If this is True and no objects are available, the view will display an empty page instead of raising a 404.

This is identical to django.views.generic.list.MultipleObjectMixin.allow_empty, except for the default value, which is False.

date_list_periodLink para esta definição

Optional A string defining the aggregation period for date_list. It must be one of 'year' (default), 'month', or 'day'.

get_dated_items()Link para esta definição

Returns a 3-tuple containing (date_list, object_list, extra_context).

date_list is the list of dates for which data is available. object_list is the list of objects. extra_context is a dictionary of context data that will be added to any context data provided by the MultipleObjectMixin.

get_dated_queryset(**lookup)Link para esta definição

Returns a queryset, filtered using the query arguments defined by lookup. Enforces any restrictions on the queryset, such as allow_empty and allow_future.

get_date_list_period()Link para esta definição

Returns the aggregation period for date_list. Returns date_list_period by default.

get_date_list(queryset, date_type=None, ordering='ASC')Link para esta definição

Returns the list of dates of type date_type for which queryset contains entries. For example, get_date_list(qs, 'year') will return the list of years for which qs has entries. If date_type isn’t provided, the result of get_date_list_period() is used. date_type and ordering are passed to QuerySet.dates().