mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-03-16 21:30:23 +00:00
* Update utils.py verify get_meta isn't none before requesting db_table * Add passenv to tox.ini * Fix test_explain in sqlite * add test that will cause error #226 * try to get around problem with PASSWORD in GitHub actions testing * fix tests broken not counting with other applications permissions --------- Co-authored-by: hho6643 <63743025+hho6643@users.noreply.github.com> Co-authored-by: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com>
18 lines
533 B
Python
18 lines
533 B
Python
from django.conf import settings
|
|
from django.db.models import Q, UniqueConstraint, Model, CharField, ForeignKey, SET_NULL
|
|
|
|
|
|
class TestModel(Model):
|
|
name = CharField(max_length=20)
|
|
owner = ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True,
|
|
on_delete=SET_NULL)
|
|
|
|
class Meta:
|
|
ordering = ('name',)
|
|
constraints = [
|
|
UniqueConstraint(
|
|
fields=["name"],
|
|
condition=Q(owner=None),
|
|
name="unique_name",
|
|
)
|
|
]
|