PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
pylint_django
/
tests
/
input
""" Checks that Pylint does not complain about various methods on Django model fields. """ # pylint: disable=missing-docstring,wrong-import-position from django.db import models from django.db.models import ForeignKey, OneToOneField class Genre(models.Model): name = models.CharField(max_length=100) class Author(models.Model): author_name = models.CharField(max_length=100) class ISBN(models.Model): value = models.CharField(max_length=100) class Book(models.Model): book_name = models.CharField(max_length=100) # Check this works with and without `to` keyword author = models.ForeignKey(to="Author", on_delete=models.CASCADE) isbn = models.OneToOneField(to=ISBN, on_delete=models.CASCADE) genre = models.ForeignKey(Genre, on_delete=models.CASCADE) def get_isbn(self): return self.isbn.value def get_author_name(self): return self.author.author_name class Fruit(models.Model): fruit_name = models.CharField(max_length=20) class Seed(models.Model): fruit = ForeignKey(to=Fruit, on_delete=models.CASCADE) def get_fruit_name(self): return self.fruit.fruit_name class User(models.Model): username = models.CharField(max_length=32) class UserProfile(models.Model): user = OneToOneField(User, on_delete=models.CASCADE) def get_username(self): return self.user.username class Human(models.Model): child = ForeignKey("self", on_delete=models.SET_NULL, null=True) parent = ForeignKey(to="self", on_delete=models.SET_NULL, null=True) def get_grandchild(self): return self.child.child def get_grandparent(self): return self.parent.parent class UserPreferences(models.Model): """ Used for testing FK which refers to another model by string, not model class, see https://github.com/PyCQA/pylint-django/issues/35 """ user = ForeignKey("User", on_delete=models.CASCADE) class UserAddress(models.Model): user = OneToOneField(to="User", on_delete=models.CASCADE) line_1 = models.CharField(max_length=100) line_2 = models.CharField(max_length=100) city = models.CharField(max_length=100) postal_code = models.CharField(max_length=100)
[+]
..
[-] func_noerror_classviews.py
[edit]
[-] func_noerror_string_foreignkey.py
[edit]
[-] external_drf_noerror_serializer.py
[edit]
[-] external_tastypie_noerror_foreign_key.py
[edit]
[-] func_noerror_gettext_lazy_format.py
[edit]
[-] func_noerror_unicode_py2_compatible.py
[edit]
[-] func_model_does_not_use_unicode_py33.py
[edit]
[-] func_noerror_model_objects.py
[edit]
[-] func_noerror_model_unicode_lambda.py
[edit]
[-] func_noerror_model_unicode_callable.py
[edit]
[+]
models
[-] func_noerror_foreign_key_ids.py
[edit]
[-] func_model_no_explicit_unicode_str_compat.py
[edit]
[-] external_django_tables2_noerror_meta_class.py
[edit]
[-] func_noerror_urls.py
[edit]
[-] func_noerror_forms_py33.py
[edit]
[-] func_hard_coded_auth_user.txt
[edit]
[-] func_json_response.txt
[edit]
[-] func_noerror_managers_return_querysets.py
[edit]
[+]
__pycache__
[-] func_model_does_not_use_unicode_py33.txt
[edit]
[-] func_noerror_issue_46.py
[edit]
[-] func_noerror_protected_meta_access.py
[edit]
[-] func_unused_arguments.py
[edit]
[-] external_psycopg2_noerror_postgres_fields.py
[edit]
[-] func_noerror_import_q.py
[edit]
[-] func_model_no_explicit_unicode_str_compat.txt
[edit]
[-] func_noerror_generic_foreign_key.py
[edit]
[-] external_model_utils_noerror_override_manager.rc
[edit]
[-] func_noerror_foreign_key_sets.py
[edit]
[-] func_noerror_model_methods.py
[edit]
[-] external_factory_boy_noerror.rc
[edit]
[-] external_drf_noerror_serializer.rc
[edit]
[-] func_noerror_wsgi.py
[edit]
[-] func_noerror_formview_ancestors.py
[edit]
[-] func_noerror_manytomanyfield.py
[edit]
[-] func_noerror_foreign_key_package.py
[edit]
[-] func_noerror_form_fields.py
[edit]
[-] func_noerror_factory_post_generation.py
[edit]
[-] func_noerror_model_fields.py
[edit]
[-] func_noerror_test_wsgi_request.py
[edit]
[-] external_psycopg2_noerror_postgres_fields.rc
[edit]
[-] func_noerror_uuid_field.py
[edit]
[-] func_unused_arguments.txt
[edit]
[-] func_noerror_foreign_key_key_cls_unbound.py
[edit]
[-] func_noerror_models_py33.py
[edit]
[-] func_noerror_duplicate_except_doesnotexist.py
[edit]
[-] __init__.py
[edit]
[+]
migrations
[-] func_noerror_ignore_meta_subclass.py
[edit]
[-] func_noerror_foreign_key_attributes.py
[edit]
[+]
test_app
[-] func_noerror_foreignkeys.py
[edit]
[-] func_json_response.py
[edit]
[-] func_modelform_exclude.txt
[edit]
[-] func_noerror_ugettext_lazy_format.py
[edit]
[-] func_modelform_exclude.py
[edit]
[-] external_factory_boy_noerror.py
[edit]
[-] func_noerror_views.py
[edit]
[-] external_model_utils_noerror_override_manager.py
[edit]
[-] func_noerror_style_members.py
[edit]
[-] func_hard_coded_auth_user.py
[edit]