Server IP : 66.29.132.122 / Your IP : 3.128.173.88 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/opt/cloudlinux/venv/lib64/python3.11/site-packages/pylint_django/tests/input/ |
Upload File : |
""" Tests to make sure that access to _meta on a model does not raise a protected-access warning, as it is part of the public API since Django 1.8 (see https://github.com/PyCQA/pylint-django/issues/66, and https://docs.djangoproject.com/en/1.9/ref/models/meta/) """ # pylint: disable=missing-docstring from __future__ import print_function from django.db import models class ModelWhichLikesMeta(models.Model): ursuary = models.BooleanField(default=False) def do_a_thing(self): return self._meta.get_field("ursuary") if __name__ == "__main__": MODEL = ModelWhichLikesMeta() MODEL.save() print(MODEL._meta.get_field("ursuary")) print(MODEL.do_a_thing())