@@ -56,6 +56,7 @@ def __str__(self):
5656 (APPROVED , 'Approved' ),
5757)
5858
59+
5960class SubscriptionPlan (models .Model ):
6061 unique_name = models .CharField (max_length = 25 , unique = True )
6162 visible_to_users = models .BooleanField (default = True )
@@ -100,7 +101,7 @@ class Employer(models.Model):
100101 total_ratings = models .IntegerField (blank = True , default = 0 ) # in minutes
101102 badges = models .ManyToManyField (Badge , blank = True )
102103 status = models .CharField (max_length = 25 , choices = EMPLOYER_STATUS , default = APPROVED , blank = True )
103-
104+
104105 # talents on employer's favlist's will be automatically accepted
105106 automatically_accept_from_favlists = models .BooleanField (default = True )
106107
@@ -194,6 +195,7 @@ class EmployerSubscription(models.Model):
194195 status = models .CharField (max_length = 25 , choices = SUBSCRIPTION_STATUS , default = ACTIVE , blank = True )
195196 payment_mode = models .CharField (max_length = 9 ,choices = SUBSCRIPTION_MODE ,default = MONTHLY ,blank = True )
196197 stripe_sub = models .CharField (max_length = 100 , blank = True )
198+ # stripe_sub_status = models.CharField(max_length=25, blank=True)
197199 stripe_cus = models .CharField (max_length = 100 , blank = True )
198200 due_at = models .DateTimeField ()
199201
@@ -303,7 +305,7 @@ def calculate_tax_amount(self, period_wage, period_quantity):
303305class Profile (models .Model ):
304306 user = models .OneToOneField (User , on_delete = models .CASCADE , blank = True )
305307 picture = models .URLField (blank = True )
306- resume = models .URLField (blank = True )
308+ resume = models .URLField (blank = True , null = True , default = True )
307309 bio = models .TextField (max_length = 250 , blank = True )
308310 show_tutorial = models .BooleanField (default = True )
309311
@@ -807,6 +809,8 @@ class EmployeePayment(models.Model):
807809 over_time = models .DecimalField (max_digits = 10 , decimal_places = 2 , blank = True , default = 0 )
808810 legal_over_time = models .DecimalField (max_digits = 10 , decimal_places = 2 , blank = True , default = 0 ) # plus 40 hours/week
809811 breaktime_minutes = models .IntegerField (blank = True , default = 0 )
812+ regular_hours_earnings = models .DecimalField (max_digits = 10 , decimal_places = 2 , verbose_name = 'regular hours earnings' , default = 0 )
813+ over_time_earnings = models .DecimalField (max_digits = 10 , decimal_places = 2 , verbose_name = 'overtime earnings' , default = 0 )
810814 earnings = models .DecimalField (max_digits = 10 , decimal_places = 2 , verbose_name = 'gross earnings' )
811815 amount = models .DecimalField (max_digits = 10 , decimal_places = 2 , blank = True , default = 0 , verbose_name = 'net earnings' )
812816 deductions = models .DecimalField (max_digits = 10 , decimal_places = 2 , blank = True , default = 0 )
@@ -1054,11 +1058,29 @@ class W4Form(models.Model):
10541058 updated_at = models .DateTimeField (auto_now = True , editable = False )
10551059 status = models .CharField (max_length = 8 , choices = W4_FORM_STATUS , default = PENDING )
10561060
1061+ class Payment (models .Model ):
1062+ stripe_charge_id = models .CharField (max_length = 50 )
1063+ user = models .ForeignKey (User , on_delete = models .SET_NULL , blank = True , null = True )
1064+ amount = models .FloatField ()
1065+ timestamp = models .DateTimeField (auto_now_add = True )
10571066
1067+ def __str__ (self ):
1068+ return self .user .username
1069+
1070+ def serialize (self ):
1071+ return {
1072+ 'stripe_charge_id' : self .stripe_charge_id ,
1073+ 'user' : self .user ,
1074+ 'amount' : self .amount ,
1075+ 'timestamp' : self .timestamp
1076+ }
1077+
1078+ class UserProfile (models .Model ):
1079+ user = models .OneToOneField (User , on_delete = models .CASCADE )
1080+ # employer = models.ForeignKey(Employer, on_delete=models.CASCADE, blank=True, related_name="company_users_profile")
1081+ stripe_customer_id = models .CharField (max_length = 50 , blank = True , null = True )
1082+ stripe_sub_id = models .CharField (max_length = 100 , blank = True )
10581083
1059-
1060-
1061-
1062-
1063-
1084+ def __str__ (self ):
1085+ return self .user .username
10641086
0 commit comments