Ticket #26551: models.py

File models.py, 861 bytes (added by Erik B. Andersen, 9 years ago)

models.py (with comment that has command to run on shell to trigger behavior)

Line 
1from 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
9class BookInstance(models.Model):
10 someattr = models.CharField(max_length=13, blank=True)
11
12class 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
17class AgentAgreement(models.Model):
18 book = models.ForeignKey(BookInstance, related_name='delegation')
19
20class Listing(models.Model):
21 book_instance = models.ForeignKey(BookInstance, related_name='listings')
22
Back to Top