File: func_noerror_model_objects.py

package info (click to toggle)
pylint-django 2.0.13-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 660 kB
  • sloc: python: 1,807; sh: 13; makefile: 5
file content (20 lines) | stat: -rw-r--r-- 472 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Test that defining `objects` as a regular model manager
# doesn't raise issues, see
# https://github.com/PyCQA/pylint-django/issues/144
#
# pylint: disable=missing-docstring

from django.db import models


class ModelWithRegularManager(models.Model):
    objects = models.Manager()

    name = models.CharField()


def function():
    record = ModelWithRegularManager.objects.all()[0]

    for record in ModelWithRegularManager.objects.all():
        print(record.name)