File: func_noerror_model_methods.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 (23 lines) | stat: -rw-r--r-- 610 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
21
22
23
"""
Checks that Pylint does not complain about using Model and Manager methods
"""
#  pylint: disable=missing-docstring
from django.db import models


class SomeModel(models.Model):
    name = models.CharField(max_length=64)


if __name__ == '__main__':
    MODEL = SomeModel()
    MODEL.save()
    MODEL.delete()

    COUNT = SomeModel.objects.count()
    # added in django 1.6
    FIRST = SomeModel.objects.first()
    LAST = SomeModel.objects.last()

    DB_RECORD, CREATED = SomeModel.objects.get_or_create(name='Tester')
    EXCLUDED_IDS = [obj.pk for obj in SomeModel.objects.exclude(name__isnull=True)]