1 | from django.db import models
|
---|
2 |
|
---|
3 | # from django.utils import timezone
|
---|
4 | # from django.db.models import Q
|
---|
5 | # from problemdemo.models import *
|
---|
6 | # AgentAgreement.objects.filter(~(Q(book__listings__contract__handoffdate__lte=timezone.now()) & Q(book__listings__contract__returndate=None) ))
|
---|
7 |
|
---|
8 |
|
---|
9 | class BookInstance(models.Model):
|
---|
10 | someattr = models.CharField(max_length=13, blank=True)
|
---|
11 |
|
---|
12 | class Contract(models.Model):
|
---|
13 | listing = models.OneToOneField('Listing', related_name="contract", null=True, blank=True, default=None)
|
---|
14 | handoffdate = models.DateTimeField(null=True, blank=True, default=None)
|
---|
15 | returndate = models.DateTimeField(null=True, blank=True, default=None)
|
---|
16 |
|
---|
17 | class AgentAgreement(models.Model):
|
---|
18 | book = models.ForeignKey(BookInstance, related_name='delegation')
|
---|
19 |
|
---|
20 | class Listing(models.Model):
|
---|
21 | book_instance = models.ForeignKey(BookInstance, related_name='listings')
|
---|
22 |
|
---|