0
from django.db import models
0
from django.contrib.localflavor.us.models import PhoneNumberField
0
+from tagging.fields import TagField
0
@@ -63,16 +66,78 @@ class Person(models.Model):
0
email = models.EmailField(null=True,blank=True)
0
notes = models.CharField(max_length=100,null=True,blank=True)
0
- return "%s" % (self.name)
0
+ def __unicode__(self):
0
verbose_name_plural = 'People'
0
+class Employee(Person):
0
+ ('check', 'Mail Check'),
0
+ ('wire', 'Wire Transfer'),
0
+ gmt_offset = models.DecimalField(max_digits=3, decimal_places=1)
0
+ payment_preference = models.CharField(blank=True, max_length=100, choices=PAYMENT_CHOICES)
0
+ payment_notes = models.TextField(blank=True)
0
+ contract = models.DateField(blank=True, null=True, help_text="Date contractor contract was signed and received.")
0
+ hourly_rate = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, help_text="If rate varies, enter average and note below.")
0
+ currency = models.CharField(default="USD", max_length=3)
0
+ rate_notes = models.TextField(blank=True, help_text="Additional notes regarding contractor rates.")
0
+ if self.gmt_offset == int(self.gmt_offset):
0
+ gmt_offset = int(self.gmt_offset)
0
+ gmt_offset = self.gmt_offset
0
+ gmt_offset = '+%s' % gmt_offset
0
+ return 'GMT%s' % gmt_offset
0
+ def under_contract(self):
0
+ under_contract.boolean = True
0
+ return "%s %s" % (self.hourly_rate, self.currency)
0
+class Project(models.Model):
0
+ name = models.CharField(max_length=100)
0
+ employees = models.ManyToManyField(Employee)
0
+ start_date = models.DateField()
0
+ #bid = models.DecimalField(max_digits=8, decimal_places=2)
0
+ active = models.BooleanField(default=True)
0
+ def __unicode__(self):
0
+class ProjectTime(models.Model):
0
+ Hours spent by an employee on a project
0
- list_display = ('name','phone','email')
0
+ employee = models.ForeignKey(Employee)
0
+ project = models.ForeignKey(Project)
0
+ start_date = models.DateField(default=datetime.date.today())
0
+ end_date = models.DateField(default=datetime.date.today())
0
+ hours = models.DecimalField(max_digits=6, decimal_places=3)
0
+ cost = models.DecimalField(max_digits=9, decimal_places=2, blank=True, null=True, help_text="Leave blank to automatically calculate")
0
+ cost_converted = models.DecimalField(max_digits=9, decimal_places=2, blank=True, null=True, help_text="Cost converted to local currency")
0
+ def __unicode__(self):
0
+ return "%s on %s (%s-%s)" % (self.employee, self.project, self.start_date, self.end_date)
0
class Entry(models.Model):
0
category = models.ForeignKey(Category)