forked from googleapis/python-spanner-django
/
models.py
36 lines (27 loc) · 890 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright 2021 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""
Different models used by system tests in django-spanner code.
"""
from django.db import models
class Author(models.Model):
first_name = models.CharField(max_length=20)
last_name = models.CharField(max_length=20)
rating = models.DecimalField()
class Number(models.Model):
num = models.DecimalField()
def __str__(self):
return str(self.num)
class Event(models.Model):
start_date = models.DateTimeField()
end_date = models.DateTimeField()
class Meta:
constraints = [
models.CheckConstraint(
check=models.Q(end_date__gt=models.F("start_date")),
name="check_start_date",
),
]