auth.models.User.has_perm()

has_perm(perm, obj=None) Returns True if the user has the specified permission, where perm is in the format "<app label>.<permission codename>". (see documentation on permissions). If the user is inactive, this method will always return False. If obj is passed in, this method won’t check for a permission for the model, but for this specific object.

views.generic.detail.DetailView

class django.views.generic.detail.DetailView While this view is executing, self.object will contain the object that the view is operating upon. Ancestors (MRO) This view inherits methods and attributes from the following views: django.views.generic.detail.SingleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.detail.BaseDetailView django.views.generic.detail.SingleObjectMixin django.views.generic.base.View Method Flowchart dispatch() http_met

test.SimpleTestCase.client_class

SimpleTestCase.client_class If you want to use a different Client class (for example, a subclass with customized behavior), use the client_class class attribute: from django.test import TestCase, Client class MyTestClient(Client): # Specialized methods for your environment ... class MyTest(TestCase): client_class = MyTestClient def test_my_stuff(self): # Here self.client is an instance of MyTestClient... call_some_test_code()

forms.BoundField.label_tag()

BoundField.label_tag(contents=None, attrs=None, label_suffix=None) [source] To separately render the label tag of a form field, you can call its label_tag() method: >>> f = ContactForm(data={'message': ''}) >>> print(f['message'].label_tag()) <label for="id_message">Message:</label> You can provide the contents parameter which will replace the auto-generated label tag. An attrs dictionary may contain additional attributes for the <label> tag. The HTML tha

sessions.base_session.AbstractBaseSession.expire_date

expire_date A datetime designating when the session expires. Expired sessions are not available to a user, however, they may still be stored in the database until the clearsessions management command is run.

forms.DecimalField.max_digits

max_digits The maximum number of digits (those before the decimal point plus those after the decimal point, with leading zeros stripped) permitted in the value.

forms.Form.fields

Form.fields You can access the fields of Form instance from its fields attribute: >>> for row in f.fields.values(): print(row) ... <django.forms.fields.CharField object at 0x7ffaac632510> <django.forms.fields.URLField object at 0x7ffaac632f90> <django.forms.fields.CharField object at 0x7ffaac3aa050> >>> f.fields['name'] <django.forms.fields.CharField object at 0x7ffaac6324d0> You can alter the field of Form instance to change the way it is presented

db.models.BinaryField

class BinaryField(**options) [source] A field to store raw binary data. It only supports bytes assignment. Be aware that this field has limited functionality. For example, it is not possible to filter a queryset on a BinaryField value. It is also not possible to include a BinaryField in a ModelForm. Abusing BinaryField Although you might think about storing files in the database, consider that it is bad design in 99% of the cases. This field is not a replacement for proper static files hand

utils.translation.activate()

activate(language) [source] Fetches the translation object for a given language and activates it as the current translation object for the current thread.

auth.signals.user_login_failed()

user_login_failed() Sent when the user failed to login successfully sender The name of the module used for authentication. credentials A dictionary of keyword arguments containing the user credentials that were passed to authenticate() or your own custom authentication backend. Credentials matching a set of ‘sensitive’ patterns, (including password) will not be sent in the clear as part of the signal.