Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- from django.contrib.auth.models import User
- class Client(models.Model):
- name = models.CharField(max_length=60)
- client_site = models.CharField(max_length=60)
- owner = models.CharField(max_length=60)
- add1 = models.CharField(max_length=60)
- add2 = models.CharField(max_length=60)
- city = models.CharField(max_length=60)
- county = models.CharField(max_length=60)
- postcode = models.CharField(max_length=10)
- country = models.CharField(max_length=60)
- class ClientUser(User):
- client = models.ForeignKey(Client)
- #The below are already included in the parent User model
- '''firstname = models.CharField(max_length=60)
- surname = models.CharField(max_length=60)
- password = models.CharField(max_length=60)
- email = models.CharField(max_length=60)'''
- phone1 = models.CharField(max_length=60)
- phone2 = models.CharField(max_length=60)
- LEVEL_CHOICES = ('example', 'Example Friendly Title')
- class Contract(models.Model):
- client = models.ForeignKey(Client)
- start_date = models.DateTimeField('start date')
- end_date = models.DateTimeField('end date')
- level = models.CharField(max_length=50, choices=LEVEL_CHOICES)
- class Request(models.Model):
- clientuser = models.ForeignKey(ClientUser)
- requesttype = models.CharField(max_length=50)
- open_date = models.DateTimeField('open date', auto_now_add=True) #auto_now_add means it's set to the date when the object is added
- title = models.CharField(max_length=200)
- description = models.CharField(max_length=200)
- status = models.CharField(max_length=200)
- close_date = models.DateTimeField('close date')
- STATUS_CHANGE_CHOICES = ('example', 'Example Friendly Title')
- class RequestLog(models.Model):
- request = models.ForeignKey(Request)
- log_date = models.DateTimeField('log date', auto_now_add=True)
- user = models.ForeignKey(User)
- comment = models.TextField()
- statuschange = models.CharField(maxlength=16, choices=STATUS_CHANGE_CHOICES)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement