/opt/cloudlinux/venv/lib/python3.11/site-packages/pylint_django/tests/input
""" Checks that Pylint does not complain about various methods on many-to-many relationships """ from django.contrib.auth.models import AbstractUser, Permission # pylint: disable=missing-docstring from django.db import models class Book(models.Model): name = models.CharField(max_length=100) good = models.BooleanField(default=False) class Author(models.Model): name = models.CharField(max_length=100) wrote = models.ManyToManyField(Book, verbose_name="Book", related_name="books") def get_good_books(self): return self.wrote.filter(good=True) def is_author_of(self, book): return book in list(self.wrote.all()) def wrote_how_many(self): return self.wrote.count() # Custom permissions for CustomUser USER_PERMS = ["change_customuser", "add_customuser"] class CustomUser(AbstractUser): # pylint: disable=model-no-explicit-unicode class Meta: verbose_name = "CustomUser" verbose_name_plural = "CustomUsers" app_label = "users" def grant_permissions(self): """Example adding permissions to User""" self.user_permissions.clear() for perm in USER_PERMS: perm = Permission.objects.get(codename=perm) self.user_permissions.add(perm) return self.user_permissions def add_permission(self, permission): self.user_permissions.add(permission) def remove_permission(self, permission): self.user_permissions.remove(permission) def set_permissions(self, permissions): self.user_permissions.set(permissions) def save(self, *args, **kwargs): """Saving while granting new permissions""" self.is_staff = True super().save() self.grant_permissions()
.
Edit
..
Edit
__init__.py
Edit
__pycache__
Edit
external_django_tables2_noerror_meta_class.py
Edit
external_drf_noerror_serializer.py
Edit
external_drf_noerror_serializer.rc
Edit
external_factory_boy_noerror.py
Edit
external_factory_boy_noerror.rc
Edit
external_model_utils_noerror_override_manager.py
Edit
external_model_utils_noerror_override_manager.rc
Edit
external_psycopg2_noerror_postgres_fields.py
Edit
external_psycopg2_noerror_postgres_fields.rc
Edit
external_tastypie_noerror_foreign_key.py
Edit
func_hard_coded_auth_user.py
Edit
func_hard_coded_auth_user.txt
Edit
func_json_response.py
Edit
func_json_response.txt
Edit
func_model_does_not_use_unicode_py33.py
Edit
func_model_does_not_use_unicode_py33.txt
Edit
func_model_no_explicit_unicode_str_compat.py
Edit
func_model_no_explicit_unicode_str_compat.txt
Edit
func_modelform_exclude.py
Edit
func_modelform_exclude.txt
Edit
func_noerror_classviews.py
Edit
func_noerror_duplicate_except_doesnotexist.py
Edit
func_noerror_factory_post_generation.py
Edit
func_noerror_foreign_key_attributes.py
Edit
func_noerror_foreign_key_ids.py
Edit
func_noerror_foreign_key_key_cls_unbound.py
Edit
func_noerror_foreign_key_package.py
Edit
func_noerror_foreign_key_sets.py
Edit
func_noerror_foreignkeys.py
Edit
func_noerror_form_fields.py
Edit
func_noerror_forms_py33.py
Edit
func_noerror_formview_ancestors.py
Edit
func_noerror_generic_foreign_key.py
Edit
func_noerror_gettext_lazy_format.py
Edit
func_noerror_ignore_meta_subclass.py
Edit
func_noerror_import_q.py
Edit
func_noerror_issue_46.py
Edit
func_noerror_managers_return_querysets.py
Edit
func_noerror_manytomanyfield.py
Edit
func_noerror_model_fields.py
Edit
func_noerror_model_methods.py
Edit
func_noerror_model_objects.py
Edit
func_noerror_model_unicode_callable.py
Edit
func_noerror_model_unicode_lambda.py
Edit
func_noerror_models_py33.py
Edit
func_noerror_protected_meta_access.py
Edit
func_noerror_string_foreignkey.py
Edit
func_noerror_style_members.py
Edit
func_noerror_test_wsgi_request.py
Edit
func_noerror_ugettext_lazy_format.py
Edit
func_noerror_unicode_py2_compatible.py
Edit
func_noerror_urls.py
Edit
func_noerror_uuid_field.py
Edit
func_noerror_views.py
Edit
func_noerror_wsgi.py
Edit
func_unused_arguments.py
Edit
func_unused_arguments.txt
Edit
migrations
Edit
models
Edit
test_app
Edit