auth.models.AbstractBaseUser.set_unusable_password()

set_unusable_password() Marks the user as having no password set. This isn’t the same as having a blank string for a password. check_password() for this user will never return True. Doesn’t save the AbstractBaseUser object. You may need this if authentication for your application takes place against an existing external source such as an LDAP directory.

template.context_processors.debug()

debug() [source] If this processor is enabled, every RequestContext will contain these two variables – but only if your DEBUG setting is set to True and the request’s IP address (request.META['REMOTE_ADDR']) is in the INTERNAL_IPS setting: debug – True. You can use this in templates to test whether you’re in DEBUG mode. sql_queries – A list of {'sql': ..., 'time': ...} dictionaries, representing every SQL query that has happened so far during the request and how long it took. The list is i

auth.password_validation.UserAttributeSimilarityValidator

class UserAttributeSimilarityValidator(user_attributes=DEFAULT_USER_ATTRIBUTES, max_similarity=0.7) [source] Validates whether the password is sufficiently different from certain attributes of the user. The user_attributes parameter should be an iterable of names of user attributes to compare to. If this argument is not provided, the default is used: 'username', 'first_name', 'last_name', 'email'. Attributes that don’t exist are ignored. The maximum similarity the password can have, before i

shortcuts.get_object_or_404()

get_object_or_404(klass, *args, **kwargs) [source] Calls get() on a given model manager, but it raises Http404 instead of the model’s DoesNotExist exception.

forms.DateTimeField

class DateTimeField(**kwargs) [source] Default widget: DateTimeInput Empty value: None Normalizes to: A Python datetime.datetime object. Validates that the given value is either a datetime.datetime, datetime.date or string formatted in a particular datetime format. Error message keys: required, invalid Takes one optional argument: input_formats A list of formats used to attempt to convert a string to a valid datetime.datetime object. If no input_formats argument is provided, the d

admin.ModelAdmin.get_formsets_with_inlines()

ModelAdmin.get_formsets_with_inlines(request, obj=None) [source] Yields (FormSet, InlineModelAdmin) pairs for use in admin add and change views. For example if you wanted to display a particular inline only in the change view, you could override get_formsets_with_inlines as follows: class MyModelAdmin(admin.ModelAdmin): inlines = [MyInline, SomeOtherInline] def get_formsets_with_inlines(self, request, obj=None): for inline in self.get_inline_instances(request, obj):

template.Library.filter()

django.template.Library.filter() Once you’ve written your filter definition, you need to register it with your Library instance, to make it available to Django’s template language: register.filter('cut', cut) register.filter('lower', lower) The Library.filter() method takes two arguments: The name of the filter – a string. The compilation function – a Python function (not the name of the function as a string). You can use register.filter() as a decorator instead: @register.filter(name='cu

views.generic.dates.DateDetailView

class DateDetailView [source] 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.g

views.generic.base.TemplateResponseMixin.response_class

response_class The response class to be returned by render_to_response method. Default is TemplateResponse. The template and context of TemplateResponse instances can be altered later (e.g. in template response middleware). If you need custom template loading or custom context object instantiation, create a TemplateResponse subclass and assign it to response_class.

forms.TimeField

class TimeField(**kwargs) [source] Default widget: TextInput 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 of formats used to attempt to convert a string to a valid datetime.time object. If no input_formats argument is provided, the default input formats are: '%H:%M:%S',