Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(6)  |  Derive(0)  |  Import(1)

src/d/j/django-pgfields-HEAD/tests/managers/tests.py   django-pgfields(Download)
from django.utils.unittest import skipIf
from django_pg import models
from django_pg.models.base import select_manager
from django_pg.utils.gis import gis_backend
 
        class Foo1(models.Model):
            objects = select_manager()
            bar = models.IntegerField()
        self.assertIsInstance(Foo1.objects, models.Manager)
 
    @override_settings(DJANGOPG_DEFAULT_MANAGER=models.Manager)
    def test_base_manager_obj(self):
        class Foo2(models.Model):
            objects = select_manager()
        class Foo3(models.Model):
            objects = select_manager()
            bar = models.IntegerField()
        self.assertIsInstance(Foo3.objects, models.GeoManager)
 
    @skipIf(not gis_backend, 'GIS disabled.')
    def test_geo_manager_obj(self):
        with self.settings(DJANGOPG_DEFAULT_MANAGER=models.GeoManager):
            class Foo4(models.Model):
                objects = select_manager()