neulab/docprompting-conala huggingface dataset:
has_module_perms(package_name)  
Returns True if the user has any permissions in the given package (the Django app label). If the user is inactive, this method will always return False. For an active superuser, this method will always return True.
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. For an active superuser, this method will always return True. If obj is passed in, this method won’t check for a permission for the model, but for this specific object.
has_perms(perm_list, obj=None)  
Returns True if the user has each of the specified permissions, where each perm is in the format "<app label>.<permission codename>". If the user is inactive, this method will always return False. For an active superuser, this method will always return True. If obj is passed in, this method won’t check for permissions for the model, but for the specific object.
is_active  
Boolean. Designates whether this user account should be considered active. We recommend that you set this flag to False instead of deleting accounts; that way, if your applications have any foreign keys to users, the foreign keys won’t break. This doesn’t necessarily control whether or not the user can log in. Authentication backends aren’t required to check for the is_active flag but the default backend (ModelBackend) and the RemoteUserBackend do. You can use AllowAllUsersModelBackend or AllowAllUsersRemoteUserBackend if you want to allow inactive users to login. In this case, you’ll also want to customize the AuthenticationForm used by the LoginView as it rejects inactive users. Be aware that the permission-checking methods such as has_perm() and the authentication in the Django admin all return False for inactive users.
password  
Required. A hash of, and metadata about, the password. (Django doesn’t store the raw password.) Raw passwords can be arbitrarily long and can contain any character. See the password documentation.
set_password(raw_password)  
Sets the user’s password to the given raw string, taking care of the password hashing. Doesn’t save the User object. When the raw_password is None, the password will be set to an unusable password, as if set_unusable_password() were used.
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 User object. You may need this if authentication for your application takes place against an existing external source such as an LDAP directory.
username  
Required. 150 characters or fewer. Usernames may contain alphanumeric, _, @, +, . and - characters. The max_length should be sufficient for many use cases. If you need a longer length, please use a custom user model. If you use MySQL with the utf8mb4 encoding (recommended for proper Unicode support), specify at most max_length=191 because MySQL can only create unique indexes with 191 characters in that case by default.
class models.UserManager  
The User model has a custom manager that has the following helper methods (in addition to the methods provided by BaseUserManager):  
create_user(username, email=None, password=None, **extra_fields)  
Creates, saves and returns a User. The username and password are set as given. The domain portion of email is automatically converted to lowercase, and the returned User object will have is_active set to True. If no password is provided, set_unusable_password() will be called. The extra_fields keyword arguments are passed through to the User’s __init__ method to allow setting arbitrary fields on a custom user model. See Creating users for example usage. 
  
create_superuser(username, email=None, password=None, **extra_fields)  
Same as create_user(), but sets is_staff and is_superuser to True. 
  
with_perm(perm, is_active=True, include_superusers=True, backend=None, obj=None)  
Returns users that have the given permission perm either in the "<app label>.<permission codename>" format or as a Permission instance. Returns an empty queryset if no users who have the perm found. If is_active is True (default), returns only active users, or if False, returns only inactive users. Use None to return all users irrespective of active state. If include_superusers is True (default), the result will include superusers. If backend is passed in and it’s defined in AUTHENTICATION_BACKENDS, then this method will use it. Otherwise, it will use the backend in AUTHENTICATION_BACKENDS, if there is only one, or raise an exception.
create_superuser(username, email=None, password=None, **extra_fields)  
Same as create_user(), but sets is_staff and is_superuser to True.
create_user(username, email=None, password=None, **extra_fields)  
Creates, saves and returns a User. The username and password are set as given. The domain portion of email is automatically converted to lowercase, and the returned User object will have is_active set to True. If no password is provided, set_unusable_password() will be called. The extra_fields keyword arguments are passed through to the User’s __init__ method to allow setting arbitrary fields on a custom user model. See Creating users for example usage.
with_perm(perm, is_active=True, include_superusers=True, backend=None, obj=None)  
Returns users that have the given permission perm either in the "<app label>.<permission codename>" format or as a Permission instance. Returns an empty queryset if no users who have the perm found. If is_active is True (default), returns only active users, or if False, returns only inactive users. Use None to return all users irrespective of active state. If include_superusers is True (default), the result will include superusers. If backend is passed in and it’s defined in AUTHENTICATION_BACKENDS, then this method will use it. Otherwise, it will use the backend in AUTHENTICATION_BACKENDS, if there is only one, or raise an exception.
class CommonPasswordValidator(password_list_path=DEFAULT_PASSWORD_LIST_PATH)  
Validates whether the password is not a common password. This converts the password to lowercase (to do a case-insensitive comparison) and checks it against a list of 20,000 common password created by Royce Williams. The password_list_path can be set to the path of a custom file of common passwords. This file should contain one lowercase password per line and may be plain text or gzipped.
get_password_validators(validator_config)  
Returns a set of validator objects based on the validator_config parameter. By default, all functions use the validators defined in AUTH_PASSWORD_VALIDATORS, but by calling this function with an alternate set of validators and then passing the result into the password_validators parameter of the other functions, your custom set of validators will be used instead. This is useful when you have a typical set of validators to use for most scenarios, but also have a special situation that requires a custom set. If you always use the same set of validators, there is no need to use this function, as the configuration from AUTH_PASSWORD_VALIDATORS is used by default. The structure of validator_config is identical to the structure of AUTH_PASSWORD_VALIDATORS. The return value of this function can be passed into the password_validators parameter of the functions listed above.
class MinimumLengthValidator(min_length=8)  
Validates whether the password meets a minimum length. The minimum length can be customized with the min_length parameter.
password_changed(password, user=None, password_validators=None)  
Informs all validators that the password has been changed. This can be used by validators such as one that prevents password reuse. This should be called once the password has been successfully changed. For subclasses of AbstractBaseUser, the password field will be marked as “dirty” when calling set_password() which triggers a call to password_changed() after the user is saved.
password_validators_help_text_html(password_validators=None)  
Returns an HTML string with all help texts in an <ul>. This is helpful when adding password validation to forms, as you can pass the output directly to the help_text parameter of a form field.
password_validators_help_texts(password_validators=None)  
Returns a list of the help texts of all validators. These explain the password requirements to the user.
class UserAttributeSimilarityValidator(user_attributes=DEFAULT_USER_ATTRIBUTES, max_similarity=0.7)  
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 minimum similarity of a rejected password can be set on a scale of 0 to 1 with the max_similarity parameter. A setting of 0 rejects all passwords, whereas a setting of 1 rejects only passwords that are identical to an attribute’s value.
validate_password(password, user=None, password_validators=None)  
Validates a password. If all validators find the password valid, returns None. If one or more validators reject the password, raises a ValidationError with all the error messages from the validators. The user object is optional: if it’s not provided, some validators may not be able to perform any validation and will accept any password.
user_logged_in()  
Sent when a user logs in successfully. Arguments sent with this signal:  
sender  The class of the user that just logged in. 
request  The current HttpRequest instance. 
user  The user instance that just logged in.
user_logged_out()  
Sent when the logout method is called.  
sender  As above: the class of the user that just logged out or None if the user was not authenticated. 
request  The current HttpRequest instance. 
user  The user instance that just logged out or None if the user was not authenticated.
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. 
request  The HttpRequest object, if one was provided to authenticate().
update_session_auth_hash(request, user)  
This function takes the current request and the updated user object from which the new session hash will be derived and updates the session hash appropriately. It also rotates the session key so that a stolen session cookie will be invalidated. Example usage: from django.contrib.auth import update_session_auth_hash

def password_change(request):
    if request.method == 'POST':
        form = PasswordChangeForm(user=request.user, data=request.POST)
        if form.is_valid():
            form.save()
            update_session_auth_hash(request, form.user)
    else:
        ...
class validators.ASCIIUsernameValidator  
A field validator allowing only ASCII letters and numbers, in addition to @, ., +, -, and _.
class validators.UnicodeUsernameValidator  
A field validator allowing Unicode characters, in addition to @, ., +, -, and _. The default validator for User.username.
authentication_form  
A callable (typically a form class) to use for authentication. Defaults to AuthenticationForm.
extra_context  
A dictionary of context data that will be added to the default context data passed to the template.
get_default_redirect_url()  
 New in Django 4.0.  Returns the URL to redirect to after login. The default implementation resolves and returns next_page if set, or LOGIN_REDIRECT_URL otherwise.
next_page  
 New in Django 4.0.  The URL to redirect to after login. Defaults to LOGIN_REDIRECT_URL.
redirect_authenticated_user  
A boolean that controls whether or not authenticated users accessing the login page will be redirected as if they had just successfully logged in. Defaults to False.  Warning If you enable redirect_authenticated_user, other websites will be able to determine if their visitors are authenticated on your site by requesting redirect URLs to image files on your website. To avoid this “social media fingerprinting” information leakage, host all images and your favicon on a separate domain. Enabling redirect_authenticated_user can also result in a redirect loop when using the permission_required() decorator unless the raise_exception parameter is used.
redirect_field_name  
The name of a GET field containing the URL to redirect to after login. Defaults to next. Overrides the get_default_redirect_url() URL if the given GET parameter is passed.
success_url_allowed_hosts  
A set of hosts, in addition to request.get_host(), that are safe for redirecting after login. Defaults to an empty set.
template_name  
The name of a template to display for the view used to log the user in. Defaults to registration/login.html.
logout_then_login(request, login_url=None)  
Logs a user out, then redirects to the login page. URL name: No default URL provided Optional arguments:  
login_url: The URL of the login page to redirect to. Defaults to settings.LOGIN_URL if not supplied.
class LogoutView  
Logs a user out. URL name: logout Attributes:  
next_page  
The URL to redirect to after logout. Defaults to LOGOUT_REDIRECT_URL. 
  
template_name  
The full name of a template to display after logging the user out. Defaults to registration/logged_out.html. 
  
redirect_field_name  
The name of a GET field containing the URL to redirect to after log out. Defaults to 'next'. Overrides the next_page URL if the given GET parameter is passed. 
  
extra_context  
A dictionary of context data that will be added to the default context data passed to the template. 
  
success_url_allowed_hosts  
A set of hosts, in addition to request.get_host(), that are safe for redirecting after logout. Defaults to an empty set. 
 Template context:  
title: The string “Logged out”, localized. 
site: The current Site, according to the SITE_ID setting. If you don’t have the site framework installed, this will be set to an instance of RequestSite, which derives the site name and domain from the current HttpRequest. 
site_name: An alias for site.name. If you don’t have the site framework installed, this will be set to the value of request.META['SERVER_NAME']. For more on sites, see The “sites” framework.
next_page  
The URL to redirect to after logout. Defaults to LOGOUT_REDIRECT_URL.
redirect_field_name  
The name of a GET field containing the URL to redirect to after log out. Defaults to 'next'. Overrides the next_page URL if the given GET parameter is passed.
success_url_allowed_hosts  
A set of hosts, in addition to request.get_host(), that are safe for redirecting after logout. Defaults to an empty set.
template_name  
The full name of a template to display after logging the user out. Defaults to registration/logged_out.html.
class PasswordChangeDoneView  
URL name: password_change_done The page shown after a user has changed their password. Attributes:  
template_name  
The full name of a template to use. Defaults to registration/password_change_done.html if not supplied. 
  
extra_context  
A dictionary of context data that will be added to the default context data passed to the template.
template_name  
The full name of a template to use. Defaults to registration/password_change_done.html if not supplied.
class PasswordChangeView  
URL name: password_change Allows a user to change their password. Attributes:  
success_url  
The URL to redirect to after a successful password change. Defaults to 'password_change_done'. 
  
form_class  
A custom “change password” form which must accept a user keyword argument. The form is responsible for actually changing the user’s password. Defaults to PasswordChangeForm. 
  
extra_context  
A dictionary of context data that will be added to the default context data passed to the template. 
 Template context:  
form: The password change form (see form_class above).
form_class  
A custom “change password” form which must accept a user keyword argument. The form is responsible for actually changing the user’s password. Defaults to PasswordChangeForm.
success_url  
The URL to redirect to after a successful password change. Defaults to 'password_change_done'.
class PasswordResetCompleteView  
URL name: password_reset_complete Presents a view which informs the user that the password has been successfully changed. Attributes:  
template_name  
The full name of a template to display the view. Defaults to registration/password_reset_complete.html. 
  
extra_context  
A dictionary of context data that will be added to the default context data passed to the template.
template_name  
The full name of a template to display the view. Defaults to registration/password_reset_complete.html.
class PasswordResetConfirmView  
URL name: password_reset_confirm Presents a form for entering a new password. Keyword arguments from the URL:  
uidb64: The user’s id encoded in base 64. 
token: Token to check that the password is valid.  Attributes:  
template_name  
The full name of a template to display the confirm password view. Default value is registration/password_reset_confirm.html. 
  
token_generator  
Instance of the class to check the password. This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. 
  
post_reset_login  
A boolean indicating if the user should be automatically authenticated after a successful password reset. Defaults to False. 
  
post_reset_login_backend  
A dotted path to the authentication backend to use when authenticating a user if post_reset_login is True. Required only if you have multiple AUTHENTICATION_BACKENDS configured. Defaults to None. 
  
form_class  
Form that will be used to set the password. Defaults to SetPasswordForm. 
  
success_url  
URL to redirect after the password reset done. Defaults to 'password_reset_complete'. 
  
extra_context  
A dictionary of context data that will be added to the default context data passed to the template. 
  
reset_url_token  
Token parameter displayed as a component of password reset URLs. Defaults to 'set-password'. 
 Template context:  
form: The form (see form_class above) for setting the new user’s password. 
validlink: Boolean, True if the link (combination of uidb64 and token) is valid or unused yet.
form_class  
Form that will be used to set the password. Defaults to SetPasswordForm.
post_reset_login  
A boolean indicating if the user should be automatically authenticated after a successful password reset. Defaults to False.
post_reset_login_backend  
A dotted path to the authentication backend to use when authenticating a user if post_reset_login is True. Required only if you have multiple AUTHENTICATION_BACKENDS configured. Defaults to None.
reset_url_token  
Token parameter displayed as a component of password reset URLs. Defaults to 'set-password'.
success_url  
URL to redirect after the password reset done. Defaults to 'password_reset_complete'.
template_name  
The full name of a template to display the confirm password view. Default value is registration/password_reset_confirm.html.
token_generator  
Instance of the class to check the password. This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator.
class PasswordResetDoneView  
URL name: password_reset_done The page shown after a user has been emailed a link to reset their password. This view is called by default if the PasswordResetView doesn’t have an explicit success_url URL set.  Note If the email address provided does not exist in the system, the user is inactive, or has an unusable password, the user will still be redirected to this view but no email will be sent.  Attributes:  
template_name  
The full name of a template to use. Defaults to registration/password_reset_done.html if not supplied. 
  
extra_context  
A dictionary of context data that will be added to the default context data passed to the template.
template_name  
The full name of a template to use. Defaults to registration/password_reset_done.html if not supplied.
email_template_name  
The full name of a template to use for generating the email with the reset password link. Defaults to registration/password_reset_email.html if not supplied.
extra_email_context  
A dictionary of context data that will be available in the email template. It can be used to override default template context values listed below e.g. domain.
form_class  
Form that will be used to get the email of the user to reset the password for. Defaults to PasswordResetForm.
from_email  
A valid email address. By default Django uses the DEFAULT_FROM_EMAIL.
html_email_template_name  
The full name of a template to use for generating a text/html multipart email with the password reset link. By default, HTML email is not sent.
subject_template_name  
The full name of a template to use for the subject of the email with the reset password link. Defaults to registration/password_reset_subject.txt if not supplied.
success_url  
The URL to redirect to after a successful password reset request. Defaults to 'password_reset_done'.
template_name  
The full name of a template to use for displaying the password reset form. Defaults to registration/password_reset_form.html if not supplied.
token_generator  
Instance of the class to check the one time link. This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator.
redirect_to_login(next, login_url=None, redirect_field_name='next')  
Redirects to the login page, and then back to another URL after a successful login. Required arguments:  
next: The URL to redirect to after a successful login.  Optional arguments:  
login_url: The URL of the login page to redirect to. Defaults to settings.LOGIN_URL if not supplied. 
redirect_field_name: The name of a GET field containing the URL to redirect to after log out. Overrides next if the given GET parameter is passed.
class GenericInlineModelAdmin  
The GenericInlineModelAdmin class inherits all properties from an InlineModelAdmin class. However, it adds a couple of its own for working with the generic relation:  
ct_field  
The name of the ContentType foreign key field on the model. Defaults to content_type. 
  
ct_fk_field  
The name of the integer field that represents the ID of the related object. Defaults to object_id.
ct_field  
The name of the ContentType foreign key field on the model. Defaults to content_type.
ct_fk_field  
The name of the integer field that represents the ID of the related object. Defaults to object_id.
class GenericStackedInline  
Subclasses of GenericInlineModelAdmin with stacked and tabular layouts, respectively.
class GenericForeignKey  
There are three parts to setting up a GenericForeignKey:  Give your model a ForeignKey to ContentType. The usual name for this field is “content_type”. Give your model a field that can store primary key values from the models you’ll be relating to. For most models, this means a PositiveIntegerField. The usual name for this field is “object_id”. Give your model a GenericForeignKey, and pass it the names of the two fields described above. If these fields are named “content_type” and “object_id”, you can omit this – those are the default field names GenericForeignKey will look for.   
for_concrete_model  
If False, the field will be able to reference proxy models. Default is True. This mirrors the for_concrete_model argument to get_for_model().
for_concrete_model  
If False, the field will be able to reference proxy models. Default is True. This mirrors the for_concrete_model argument to get_for_model().
class GenericRelation  
 
related_query_name  
The relation on the related object back to this object doesn’t exist by default. Setting related_query_name creates a relation from the related object back to this one. This allows querying and filtering from the related object.