doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
class RegexField(**kwargs)
Default widget: TextInput
Empty value: Whatever you’ve given as empty_value. Normalizes to: A string. Uses RegexValidator to validate that the given value matches a certain regular expression. Error message keys: required, invalid
Takes one required argument:
regex
A regular express... | django.ref.forms.fields#django.forms.RegexField |
regex
A regular expression specified either as a string or a compiled regular expression object. | django.ref.forms.fields#django.forms.RegexField.regex |
strip
Defaults to False. If enabled, stripping will be applied before the regex validation. | django.ref.forms.fields#django.forms.RegexField.strip |
class DjangoTemplates | django.ref.forms.renderers#django.forms.renderers.DjangoTemplates |
class Jinja2 | django.ref.forms.renderers#django.forms.renderers.Jinja2 |
class TemplatesSetting | django.ref.forms.renderers#django.forms.renderers.TemplatesSetting |
class Select
template_name: 'django/forms/widgets/select.html'
option_template_name: 'django/forms/widgets/select_option.html'
Renders as: <select><option ...>...</select>
choices
This attribute is optional when the form field does not have a choices attribute. If it does, it will override anything you set... | django.ref.forms.widgets#django.forms.Select |
choices
This attribute is optional when the form field does not have a choices attribute. If it does, it will override anything you set here when the attribute is updated on the Field. | django.ref.forms.widgets#django.forms.Select.choices |
class SelectDateWidget
template_name: 'django/forms/widgets/select_date.html'
Wrapper around three Select widgets: one each for month, day, and year. Takes several optional arguments:
years
An optional list/tuple of years to use in the “year” select box. The default is a list containing the current year and t... | django.ref.forms.widgets#django.forms.SelectDateWidget |
empty_label
If the DateField is not required, SelectDateWidget will have an empty choice at the top of the list (which is --- by default). You can change the text of this label with the empty_label attribute. empty_label can be a string, list, or tuple. When a string is used, all select boxes will each have an empty ... | django.ref.forms.widgets#django.forms.SelectDateWidget.empty_label |
months
An optional dict of months to use in the “months” select box. The keys of the dict correspond to the month number (1-indexed) and the values are the displayed months: MONTHS = {
1:_('jan'), 2:_('feb'), 3:_('mar'), 4:_('apr'),
5:_('may'), 6:_('jun'), 7:_('jul'), 8:_('aug'),
9:_('sep'), 10:_('oct'), ... | django.ref.forms.widgets#django.forms.SelectDateWidget.months |
years
An optional list/tuple of years to use in the “year” select box. The default is a list containing the current year and the next 9 years. | django.ref.forms.widgets#django.forms.SelectDateWidget.years |
class SelectMultiple
template_name: 'django/forms/widgets/select.html'
option_template_name: 'django/forms/widgets/select_option.html'
Similar to Select, but allows multiple selection: <select multiple>...</select> | django.ref.forms.widgets#django.forms.SelectMultiple |
class SlugField(**kwargs)
Default widget: TextInput
Empty value: Whatever you’ve given as empty_value. Normalizes to: A string. Uses validate_slug or validate_unicode_slug to validate that the given value contains only letters, numbers, underscores, and hyphens. Error messages: required, invalid
This field is int... | django.ref.forms.fields#django.forms.SlugField |
allow_unicode
A boolean instructing the field to accept Unicode letters in addition to ASCII letters. Defaults to False. | django.ref.forms.fields#django.forms.SlugField.allow_unicode |
empty_value
The value to use to represent “empty”. Defaults to an empty string. | django.ref.forms.fields#django.forms.SlugField.empty_value |
class SplitDateTimeField(**kwargs)
Default widget: SplitDateTimeWidget
Empty value: None
Normalizes to: A Python datetime.datetime object. Validates that the given value is a datetime.datetime or string formatted in a particular datetime format. Error message keys: required, invalid, invalid_date, invalid_time
T... | django.ref.forms.fields#django.forms.SplitDateTimeField |
input_date_formats
A list of formats used to attempt to convert a string to a valid datetime.date object. | django.ref.forms.fields#django.forms.SplitDateTimeField.input_date_formats |
input_time_formats
A list of formats used to attempt to convert a string to a valid datetime.time object. | django.ref.forms.fields#django.forms.SplitDateTimeField.input_time_formats |
class SplitDateTimeWidget
template_name: 'django/forms/widgets/splitdatetime.html'
Wrapper (using MultiWidget) around two widgets: DateInput for the date, and TimeInput for the time. Must be used with SplitDateTimeField rather than DateTimeField. SplitDateTimeWidget has several optional arguments:
date_format ... | django.ref.forms.widgets#django.forms.SplitDateTimeWidget |
date_attrs | django.ref.forms.widgets#django.forms.SplitDateTimeWidget.date_attrs |
date_format
Similar to DateInput.format | django.ref.forms.widgets#django.forms.SplitDateTimeWidget.date_format |
time_attrs
Similar to Widget.attrs. A dictionary containing HTML attributes to be set on the rendered DateInput and TimeInput widgets, respectively. If these attributes aren’t set, Widget.attrs is used instead. | django.ref.forms.widgets#django.forms.SplitDateTimeWidget.time_attrs |
time_format
Similar to TimeInput.format | django.ref.forms.widgets#django.forms.SplitDateTimeWidget.time_format |
class SplitHiddenDateTimeWidget
template_name: 'django/forms/widgets/splithiddendatetime.html'
Similar to SplitDateTimeWidget, but uses HiddenInput for both date and time. | django.ref.forms.widgets#django.forms.SplitHiddenDateTimeWidget |
class Textarea
template_name: 'django/forms/widgets/textarea.html'
Renders as: <textarea>...</textarea> | django.ref.forms.widgets#django.forms.Textarea |
class TextInput
input_type: 'text'
template_name: 'django/forms/widgets/text.html'
Renders as: <input type="text" ...> | django.ref.forms.widgets#django.forms.TextInput |
class TimeField(**kwargs)
Default widget: TimeInput
Empty value: None
Normalizes to: A Python datetime.time object. Validates that the given value is either a datetime.time or string formatted in a particular time format. Error message keys: required, invalid
Takes one optional argument:
input_formats
A list... | django.ref.forms.fields#django.forms.TimeField |
input_formats
A list of formats used to attempt to convert a string to a valid datetime.time object. | django.ref.forms.fields#django.forms.TimeField.input_formats |
class TimeInput
input_type: 'text'
template_name: 'django/forms/widgets/time.html'
Renders as: <input type="text" ...>
Takes same arguments as TextInput, with one more optional argument:
format
The format in which this field’s initial value will be displayed.
If no format argument is provided, the defaul... | django.ref.forms.widgets#django.forms.TimeInput |
format
The format in which this field’s initial value will be displayed. | django.ref.forms.widgets#django.forms.TimeInput.format |
class TypedChoiceField(**kwargs)
Just like a ChoiceField, except TypedChoiceField takes two extra arguments, coerce and empty_value. Default widget: Select
Empty value: Whatever you’ve given as empty_value. Normalizes to: A value of the type provided by the coerce argument. Validates that the given value exists in ... | django.ref.forms.fields#django.forms.TypedChoiceField |
coerce
A function that takes one argument and returns a coerced value. Examples include the built-in int, float, bool and other types. Defaults to an identity function. Note that coercion happens after input validation, so it is possible to coerce to a value not present in choices. | django.ref.forms.fields#django.forms.TypedChoiceField.coerce |
empty_value
The value to use to represent “empty.” Defaults to the empty string; None is another common choice here. Note that this value will not be coerced by the function given in the coerce argument, so choose it accordingly. | django.ref.forms.fields#django.forms.TypedChoiceField.empty_value |
class TypedMultipleChoiceField(**kwargs)
Just like a MultipleChoiceField, except TypedMultipleChoiceField takes two extra arguments, coerce and empty_value. Default widget: SelectMultiple
Empty value: Whatever you’ve given as empty_value
Normalizes to: A list of values of the type provided by the coerce argument. ... | django.ref.forms.fields#django.forms.TypedMultipleChoiceField |
class URLField(**kwargs)
Default widget: URLInput
Empty value: Whatever you’ve given as empty_value. Normalizes to: A string. Uses URLValidator to validate that the given value is a valid URL. Error message keys: required, invalid
Has three optional arguments max_length, min_length, and empty_value which work jus... | django.ref.forms.fields#django.forms.URLField |
class URLInput
input_type: 'url'
template_name: 'django/forms/widgets/url.html'
Renders as: <input type="url" ...> | django.ref.forms.widgets#django.forms.URLInput |
class UUIDField(**kwargs)
Default widget: TextInput
Empty value: None
Normalizes to: A UUID object. Error message keys: required, invalid
This field will accept any string format accepted as the hex argument to the UUID constructor. | django.ref.forms.fields#django.forms.UUIDField |
class Widget(attrs=None)
This abstract class cannot be rendered, but provides the basic attribute attrs. You may also implement or override the render() method on custom widgets.
attrs
A dictionary containing HTML attributes to be set on the rendered widget. >>> from django import forms
>>> name = forms.TextInput... | django.ref.forms.widgets#django.forms.Widget |
attrs
A dictionary containing HTML attributes to be set on the rendered widget. >>> from django import forms
>>> name = forms.TextInput(attrs={'size': 10, 'title': 'Your name'})
>>> name.render('name', 'A name')
'<input title="Your name" type="text" name="name" value="A name" size="10">'
If you assign a value of Tru... | django.ref.forms.widgets#django.forms.Widget.attrs |
format_value(value)
Cleans and returns a value for use in the widget template. value isn’t guaranteed to be valid input, therefore subclass implementations should program defensively. | django.ref.forms.widgets#django.forms.Widget.format_value |
get_context(name, value, attrs)
Returns a dictionary of values to use when rendering the widget template. By default, the dictionary contains a single key, 'widget', which is a dictionary representation of the widget containing the following keys:
'name': The name of the field from the name argument.
'is_hidden': ... | django.ref.forms.widgets#django.forms.Widget.get_context |
id_for_label(id_)
Returns the HTML ID attribute of this widget for use by a <label>, given the ID of the field. Returns None if an ID isn’t available. This hook is necessary because some widgets have multiple HTML elements and, thus, multiple IDs. In that case, this method should return an ID value that corresponds t... | django.ref.forms.widgets#django.forms.Widget.id_for_label |
render(name, value, attrs=None, renderer=None)
Renders a widget to HTML using the given renderer. If renderer is None, the renderer from the FORM_RENDERER setting is used. | django.ref.forms.widgets#django.forms.Widget.render |
supports_microseconds
An attribute that defaults to True. If set to False, the microseconds part of datetime and time values will be set to 0. | django.ref.forms.widgets#django.forms.Widget.supports_microseconds |
use_required_attribute(initial)
Given a form field’s initial value, returns whether or not the widget can be rendered with the required HTML attribute. Forms use this method along with Field.required and Form.use_required_attribute to determine whether or not to display the required attribute for each field. By defau... | django.ref.forms.widgets#django.forms.Widget.use_required_attribute |
value_from_datadict(data, files, name)
Given a dictionary of data and this widget’s name, returns the value of this widget. files may contain data coming from request.FILES. Returns None if a value wasn’t provided. Note also that value_from_datadict may be called more than once during handling of form data, so if you... | django.ref.forms.widgets#django.forms.Widget.value_from_datadict |
value_omitted_from_data(data, files, name)
Given data and files dictionaries and this widget’s name, returns whether or not there’s data or files for the widget. The method’s result affects whether or not a field in a model form falls back to its default. Special cases are CheckboxInput, CheckboxSelectMultiple, and S... | django.ref.forms.widgets#django.forms.Widget.value_omitted_from_data |
Formsets
class BaseFormSet
A formset is a layer of abstraction to work with multiple forms on the same page. It can be best compared to a data grid. Let’s say you have the following form: >>> from django import forms
>>> class ArticleForm(forms.Form):
... title = forms.CharField()
... pub_date = forms.DateF... | django.topics.forms.formsets |
GeoDjango GeoDjango intends to be a world-class geographic web framework. Its goal is to make it as easy as possible to build GIS web applications and harness the power of spatially enabled data.
GeoDjango Tutorial Introduction Setting Up Geographic Data Geographic Models Importing Spatial Data Spatial Queries Puttin... | django.ref.contrib.gis.index |
class GeoModelAdmin
default_lon
The default center longitude.
default_lat
The default center latitude.
default_zoom
The default zoom level to use. Defaults to 4.
extra_js
Sequence of URLs to any extra JavaScript to include.
map_template
Override the template used to generate the JavaScript slippy ... | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin |
default_lat | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.default_lat |
default_lon | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.default_lon |
default_zoom | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.default_zoom |
extra_js | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.extra_js |
map_height | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.map_height |
map_template | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.map_template |
map_width | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.map_width |
modifiable | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.modifiable |
openlayers_url | django.ref.contrib.gis.admin#django.contrib.gis.admin.GeoModelAdmin.openlayers_url |
class GISModelAdmin
gis_widget
The widget class to be used for GeometryField. Defaults to OSMWidget.
gis_widget_kwargs
The keyword arguments that would be passed to the gis_widget. Defaults to an empty dictionary. | django.ref.contrib.gis.admin#django.contrib.gis.admin.GISModelAdmin |
gis_widget
The widget class to be used for GeometryField. Defaults to OSMWidget. | django.ref.contrib.gis.admin#django.contrib.gis.admin.GISModelAdmin.gis_widget |
gis_widget_kwargs
The keyword arguments that would be passed to the gis_widget. Defaults to an empty dictionary. | django.ref.contrib.gis.admin#django.contrib.gis.admin.GISModelAdmin.gis_widget_kwargs |
class OSMGeoAdmin
A subclass of GeoModelAdmin that uses a Spherical Mercator projection with OpenStreetMap street data tiles. Deprecated since version 4.0: This class is deprecated. Use GISModelAdmin instead. | django.ref.contrib.gis.admin#django.contrib.gis.admin.OSMGeoAdmin |
BaseSpatialField.spatial_index | django.ref.contrib.gis.model-api#django.contrib.gis.db.models.BaseSpatialField.spatial_index |
BaseSpatialField.srid | django.ref.contrib.gis.model-api#django.contrib.gis.db.models.BaseSpatialField.srid |
class Collect(geo_field) | django.ref.contrib.gis.geoquerysets#django.contrib.gis.db.models.Collect |
class Extent(geo_field) | django.ref.contrib.gis.geoquerysets#django.contrib.gis.db.models.Extent |
class Extent3D(geo_field) | django.ref.contrib.gis.geoquerysets#django.contrib.gis.db.models.Extent3D |
class Area(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Area |
class AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.AsGeoJSON |
class AsGML(expression, version=2, precision=8, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.AsGML |
class AsKML(expression, precision=8, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.AsKML |
class AsSVG(expression, relative=False, precision=8, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.AsSVG |
class AsWKB(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.AsWKB |
class AsWKT(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.AsWKT |
class Azimuth(point_a, point_b, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Azimuth |
class BoundingCircle(expression, num_seg=48, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.BoundingCircle |
class Centroid(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Centroid |
class Difference(expr1, expr2, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Difference |
class Distance(expr1, expr2, spheroid=None, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Distance |
class Envelope(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Envelope |
class ForcePolygonCW(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.ForcePolygonCW |
class GeoHash(expression, precision=None, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.GeoHash |
class GeometryDistance(expr1, expr2, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.GeometryDistance |
class Intersection(expr1, expr2, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Intersection |
class IsValid(expr) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.IsValid |
class Length(expression, spheroid=True, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Length |
class LineLocatePoint(linestring, point, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.LineLocatePoint |
class MakeValid(expr) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.MakeValid |
class MemSize(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.MemSize |
class NumGeometries(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.NumGeometries |
class NumPoints(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.NumPoints |
class Perimeter(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Perimeter |
class PointOnSurface(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.PointOnSurface |
class Reverse(expression, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Reverse |
class Scale(expression, x, y, z=0.0, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Scale |
class SnapToGrid(expression, *args, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.SnapToGrid |
class SymDifference(expr1, expr2, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.SymDifference |
class Transform(expression, srid, **extra) | django.ref.contrib.gis.functions#django.contrib.gis.db.models.functions.Transform |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.