neulab/docprompting-conala huggingface dataset:
class DateDetailView  
A page representing an individual object. If the object has a date value in the future, the view will throw a 404 error by default, unless you set allow_future to True. Ancestors (MRO)  django.views.generic.detail.SingleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.dates.BaseDateDetailView django.views.generic.dates.YearMixin django.views.generic.dates.MonthMixin django.views.generic.dates.DayMixin django.views.generic.dates.DateMixin django.views.generic.detail.BaseDetailView django.views.generic.detail.SingleObjectMixin django.views.generic.base.View  Context  Includes the single object associated with the model specified in the DateDetailView.  Notes  Uses a default template_name_suffix of _detail.  Example myapp/urls.py: from django.urls import path
from django.views.generic.dates import DateDetailView

urlpatterns = [
    path('<int:year>/<str:month>/<int:day>/<int:pk>/',
         DateDetailView.as_view(model=Article, date_field="pub_date"),
         name="archive_date_detail"),
]
 Example myapp/article_detail.html: <h1>{{ object.title }}</h1>
class DateMixin  
A mixin class providing common behavior for all date-based views. Methods and Attributes  
date_field  
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.  Warning In this situation, if you have implemented per-user time zone selection, the same URL may show a different set of objects, depending on the end user’s time zone. To avoid this, you should use a DateField as the date_field attribute.  
  
allow_future  
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()  
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()  
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.
allow_future  
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.
date_field  
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.  Warning In this situation, if you have implemented per-user time zone selection, the same URL may show a different set of objects, depending on the end user’s time zone. To avoid this, you should use a DateField as the date_field attribute.
get_allow_future()  
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.
get_date_field()  
Returns the name of the field that contains the date data that this view will operate on. Returns date_field by default.
class DayArchiveView  
A day archive page showing all objects in a given day. Days in the future throw a 404 error, regardless of whether any objects exist for future days, unless you set allow_future to True. Ancestors (MRO)  django.views.generic.list.MultipleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.dates.BaseDayArchiveView django.views.generic.dates.YearMixin django.views.generic.dates.MonthMixin django.views.generic.dates.DayMixin django.views.generic.dates.BaseDateListView django.views.generic.list.MultipleObjectMixin django.views.generic.dates.DateMixin django.views.generic.base.View  Context In addition to the context provided by MultipleObjectMixin (via BaseDateListView), the template’s context will be:  
day: A date object representing the given day. 
next_day: A date object representing the next day, according to allow_empty and allow_future. 
previous_day: A date object representing the previous day, according to allow_empty and allow_future. 
next_month: A date object representing the first day of the next month, according to allow_empty and allow_future. 
previous_month: A date object representing the first day of the previous month, according to allow_empty and allow_future.  Notes  Uses a default template_name_suffix of _archive_day.  Example myapp/views.py: from django.views.generic.dates import DayArchiveView

from myapp.models import Article

class ArticleDayArchiveView(DayArchiveView):
    queryset = Article.objects.all()
    date_field = "pub_date"
    allow_future = True
 Example myapp/urls.py: from django.urls import path

from myapp.views import ArticleDayArchiveView

urlpatterns = [
    # Example: /2012/nov/10/
    path('<int:year>/<str:month>/<int:day>/',
         ArticleDayArchiveView.as_view(),
         name="archive_day"),
]
 Example myapp/article_archive_day.html: <h1>{{ day }}</h1>

<ul>
    {% for article in object_list %}
        <li>{{ article.pub_date|date:"F j, Y" }}: {{ article.title }}</li>
    {% endfor %}
</ul>

<p>
    {% if previous_day %}
        Previous Day: {{ previous_day }}
    {% endif %}
    {% if previous_day and next_day %}--{% endif %}
    {% if next_day %}
        Next Day: {{ next_day }}
    {% endif %}
</p>
class DayMixin  
A mixin that can be used to retrieve and provide parsing information for a day component of a date. Methods and Attributes  
day_format  
The strftime() format to use when parsing the day. By default, this is '%d'. 
  
day  
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()  
Returns the strftime() format to use when parsing the day. Returns day_format by default. 
  
get_day()  
Returns the day for which this view will display data, as a string. Tries the following sources, in order:  The value of the DayMixin.day attribute. The value of the day argument captured in the URL pattern. The value of the day GET query argument.  Raises a 404 if no valid day specification can be found. 
  
get_next_day(date)  
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)  
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.
day  
Optional The value for the day, as a string. By default, set to None, which means the day will be determined using other means.
day_format  
The strftime() format to use when parsing the day. By default, this is '%d'.
get_day()  
Returns the day for which this view will display data, as a string. Tries the following sources, in order:  The value of the DayMixin.day attribute. The value of the day argument captured in the URL pattern. The value of the day GET query argument.  Raises a 404 if no valid day specification can be found.
get_day_format()  
Returns the strftime() format to use when parsing the day. Returns day_format by default.
get_next_day(date)  
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)  
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.
class MonthArchiveView  
A monthly archive page showing all objects in a given month. Objects with a date in the future are not displayed unless you set allow_future to True. Ancestors (MRO)  django.views.generic.list.MultipleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.dates.BaseMonthArchiveView django.views.generic.dates.YearMixin django.views.generic.dates.MonthMixin django.views.generic.dates.BaseDateListView django.views.generic.list.MultipleObjectMixin django.views.generic.dates.DateMixin django.views.generic.base.View  Context In addition to the context provided by MultipleObjectMixin (via BaseDateListView), the template’s context will be:  
date_list: A QuerySet object containing all days that have objects available in the given month, according to queryset, represented as datetime.datetime objects, in ascending order. 
month: A date object representing the given month. 
next_month: A date object representing the first day of the next month, according to allow_empty and allow_future. 
previous_month: A date object representing the first day of the previous month, according to allow_empty and allow_future.  Notes  Uses a default template_name_suffix of _archive_month.  Example myapp/views.py: from django.views.generic.dates import MonthArchiveView

from myapp.models import Article

class ArticleMonthArchiveView(MonthArchiveView):
    queryset = Article.objects.all()
    date_field = "pub_date"
    allow_future = True
 Example myapp/urls.py: from django.urls import path

from myapp.views import ArticleMonthArchiveView

urlpatterns = [
    # Example: /2012/08/
    path('<int:year>/<int:month>/',
         ArticleMonthArchiveView.as_view(month_format='%m'),
         name="archive_month_numeric"),
    # Example: /2012/aug/
    path('<int:year>/<str:month>/',
         ArticleMonthArchiveView.as_view(),
         name="archive_month"),
]
 Example myapp/article_archive_month.html: <ul>
    {% for article in object_list %}
        <li>{{ article.pub_date|date:"F j, Y" }}: {{ article.title }}</li>
    {% endfor %}
</ul>

<p>
    {% if previous_month %}
        Previous Month: {{ previous_month|date:"F Y" }}
    {% endif %}
    {% if next_month %}
        Next Month: {{ next_month|date:"F Y" }}
    {% endif %}
</p>
class MonthMixin  
A mixin that can be used to retrieve and provide parsing information for a month component of a date. Methods and Attributes  
month_format  
The strftime() format to use when parsing the month. By default, this is '%b'. 
  
month  
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()  
Returns the strftime() format to use when parsing the month. Returns month_format by default. 
  
get_month()  
Returns the month for which this view will display data, as a string. Tries the following sources, in order:  The value of the MonthMixin.month attribute. The value of the month argument captured in the URL pattern. The value of the month GET query argument.  Raises a 404 if no valid month specification can be found. 
  
get_next_month(date)  
Returns a date object containing the first day of the month 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_month(date)  
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.
get_month()  
Returns the month for which this view will display data, as a string. Tries the following sources, in order:  The value of the MonthMixin.month attribute. The value of the month argument captured in the URL pattern. The value of the month GET query argument.  Raises a 404 if no valid month specification can be found.
get_month_format()  
Returns the strftime() format to use when parsing the month. Returns month_format by default.
get_next_month(date)  
Returns a date object containing the first day of the month 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_month(date)  
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.
month  
Optional The value for the month, as a string. By default, set to None, which means the month will be determined using other means.
month_format  
The strftime() format to use when parsing the month. By default, this is '%b'.
class TodayArchiveView  
A day archive page showing all objects for today. This is exactly the same as django.views.generic.dates.DayArchiveView, except today’s date is used instead of the year/month/day arguments. Ancestors (MRO)  django.views.generic.list.MultipleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.dates.BaseTodayArchiveView django.views.generic.dates.BaseDayArchiveView django.views.generic.dates.YearMixin django.views.generic.dates.MonthMixin django.views.generic.dates.DayMixin django.views.generic.dates.BaseDateListView django.views.generic.list.MultipleObjectMixin django.views.generic.dates.DateMixin django.views.generic.base.View  Notes  Uses a default template_name_suffix of _archive_today.  Example myapp/views.py: from django.views.generic.dates import TodayArchiveView

from myapp.models import Article

class ArticleTodayArchiveView(TodayArchiveView):
    queryset = Article.objects.all()
    date_field = "pub_date"
    allow_future = True
 Example myapp/urls.py: from django.urls import path

from myapp.views import ArticleTodayArchiveView

urlpatterns = [
    path('today/',
         ArticleTodayArchiveView.as_view(),
         name="archive_today"),
]
  Where is the example template for TodayArchiveView? This view uses by default the same template as the DayArchiveView, which is in the previous example. If you need a different template, set the template_name attribute to be the name of the new template.
class WeekArchiveView  
A weekly archive page showing all objects in a given week. Objects with a date in the future are not displayed unless you set allow_future to True. Ancestors (MRO)  django.views.generic.list.MultipleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.dates.BaseWeekArchiveView django.views.generic.dates.YearMixin django.views.generic.dates.WeekMixin django.views.generic.dates.BaseDateListView django.views.generic.list.MultipleObjectMixin django.views.generic.dates.DateMixin django.views.generic.base.View  Context In addition to the context provided by MultipleObjectMixin (via BaseDateListView), the template’s context will be:  
week: A date object representing the first day of the given week. 
next_week: A date object representing the first day of the next week, according to allow_empty and allow_future. 
previous_week: A date object representing the first day of the previous week, according to allow_empty and allow_future.  Notes  Uses a default template_name_suffix of _archive_week.  
The week_format attribute is a strptime() format string used to parse the week number. The following values are supported:  
'%U': Based on the United States week system where the week begins on Sunday. This is the default value.  
'%W': Similar to '%U', except it assumes that the week begins on Monday. This is not the same as the ISO 8601 week number.  
'%V': ISO 8601 week number where the week begins on Monday.  New in Django 3.2: Support for the '%V' week format was added.      Example myapp/views.py: from django.views.generic.dates import WeekArchiveView

from myapp.models import Article

class ArticleWeekArchiveView(WeekArchiveView):
    queryset = Article.objects.all()
    date_field = "pub_date"
    week_format = "%W"
    allow_future = True
 Example myapp/urls.py: from django.urls import path

from myapp.views import ArticleWeekArchiveView

urlpatterns = [
    # Example: /2012/week/23/
    path('<int:year>/week/<int:week>/',
         ArticleWeekArchiveView.as_view(),
         name="archive_week"),
]
 Example myapp/article_archive_week.html: <h1>Week {{ week|date:'W' }}</h1>

<ul>
    {% for article in object_list %}
        <li>{{ article.pub_date|date:"F j, Y" }}: {{ article.title }}</li>
    {% endfor %}
</ul>

<p>
    {% if previous_week %}
        Previous Week: {{ previous_week|date:"W" }} of year {{ previous_week|date:"Y" }}
    {% endif %}
    {% if previous_week and next_week %}--{% endif %}
    {% if next_week %}
        Next week: {{ next_week|date:"W" }} of year {{ next_week|date:"Y" }}
    {% endif %}
</p>
 In this example, you are outputting the week number. Keep in mind that week numbers computed by the date template filter with the 'W' format character are not always the same as those computed by strftime() and strptime() with the '%W' format string. For year 2015, for example, week numbers output by date are higher by one compared to those output by strftime(). There isn’t an equivalent for the '%U' strftime() format string in date. Therefore, you should avoid using date to generate URLs for WeekArchiveView.
class WeekMixin  
A mixin that can be used to retrieve and provide parsing information for a week component of a date. Methods and Attributes  
week_format  
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.  New in Django 3.2: Support for the '%V' week format was added.  
  
week  
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()  
Returns the strftime() format to use when parsing the week. Returns week_format by default. 
  
get_week()  
Returns the week for which this view will display data, as a string. Tries the following sources, in order:  The value of the WeekMixin.week attribute. The value of the week argument captured in the URL pattern The value of the week GET query argument.  Raises a 404 if no valid week specification can be found. 
  
get_next_week(date)  
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)  
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.
get_next_week(date)  
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)  
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.
get_week()  
Returns the week for which this view will display data, as a string. Tries the following sources, in order:  The value of the WeekMixin.week attribute. The value of the week argument captured in the URL pattern The value of the week GET query argument.  Raises a 404 if no valid week specification can be found.
get_week_format()  
Returns the strftime() format to use when parsing the week. Returns week_format by default.
week  
Optional The value for the week, as a string. By default, set to None, which means the week will be determined using other means.
week_format  
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.  New in Django 3.2: Support for the '%V' week format was added.
class YearArchiveView  
A yearly archive page showing all available months in a given year. Objects with a date in the future are not displayed unless you set allow_future to True. Ancestors (MRO)  django.views.generic.list.MultipleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.dates.BaseYearArchiveView django.views.generic.dates.YearMixin django.views.generic.dates.BaseDateListView django.views.generic.list.MultipleObjectMixin django.views.generic.dates.DateMixin django.views.generic.base.View   
make_object_list  
A boolean specifying whether to retrieve the full list of objects for this year and pass those to the template. If True, the list of objects will be made available to the context. If False, the None queryset will be used as the object list. By default, this is False. 
  
get_make_object_list()  
Determine if an object list will be returned as part of the context. Returns make_object_list by default. 
 Context In addition to the context provided by django.views.generic.list.MultipleObjectMixin (via django.views.generic.dates.BaseDateListView), the template’s context will be:  
date_list: A QuerySet object containing all months that have objects available according to queryset, represented as datetime.datetime objects, in ascending order. 
year: A date object representing the given year. 
next_year: A date object representing the first day of the next year, according to allow_empty and allow_future. 
previous_year: A date object representing the first day of the previous year, according to allow_empty and allow_future.  Notes  Uses a default template_name_suffix of _archive_year.  Example myapp/views.py: from django.views.generic.dates import YearArchiveView

from myapp.models import Article

class ArticleYearArchiveView(YearArchiveView):
    queryset = Article.objects.all()
    date_field = "pub_date"
    make_object_list = True
    allow_future = True
 Example myapp/urls.py: from django.urls import path

from myapp.views import ArticleYearArchiveView

urlpatterns = [
    path('<int:year>/',
         ArticleYearArchiveView.as_view(),
         name="article_year_archive"),
]
 Example myapp/article_archive_year.html: <ul>
    {% for date in date_list %}
        <li>{{ date|date }}</li>
    {% endfor %}
</ul>

<div>
    <h1>All Articles for {{ year|date:"Y" }}</h1>
    {% for obj in object_list %}
        <p>
            {{ obj.title }} - {{ obj.pub_date|date:"F j, Y" }}
        </p>
    {% endfor %}
</div>
get_make_object_list()  
Determine if an object list will be returned as part of the context. Returns make_object_list by default.
make_object_list  
A boolean specifying whether to retrieve the full list of objects for this year and pass those to the template. If True, the list of objects will be made available to the context. If False, the None queryset will be used as the object list. By default, this is False.