Skip to content

Commit

Permalink
Add support for Django 2.x
Browse files Browse the repository at this point in the history
This unpins the Django version, which will install
one of Django 2.x versions and then made the required
changes to support the same in the app, i.e.
Adds on_delete options to ForeignKey and OneToOne Fields.

Closes #182
  • Loading branch information
shrikrishna authored and gitmate-bot committed Oct 12, 2018
1 parent 40bf93b commit bae1866
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 27 deletions.
66 changes: 44 additions & 22 deletions gsoc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __str__(self):


class GsocOccurrence(BaseOccurrence):
event = models.ForeignKey(GsocEvent)
event = models.ForeignKey(GsocEvent, on_delete=models.CASCADE)

def __str__(self):
return self.event
Expand All @@ -29,24 +29,46 @@ class Program(models.Model):
org_accepted_count = models.IntegerField()
state = models.CharField(max_length=100)
is_current = models.BooleanField()
org_signup_open = models.OneToOneField(GsocEvent, related_name='org_signup_open')
org_approval = models.OneToOneField(GsocEvent, related_name='org_approval')
orgs_published = models.OneToOneField(GsocEvent, related_name='org_published')
student_signup_open = models.OneToOneField(GsocEvent, related_name='student_signup_open')
slot_request = models.OneToOneField(GsocEvent, related_name='slot_request')
slot_allocation_grace_period = models.OneToOneField(GsocEvent, related_name='slot_allocation_grace_period')
project_acceptance = models.OneToOneField(GsocEvent, related_name='project_acceptance')
project_decisions_finalization = models.OneToOneField(GsocEvent, related_name='project_decisions_finalization')
first_work_period = models.OneToOneField(GsocEvent, related_name='first_work_period')
first_evaluations = models.OneToOneField(GsocEvent, related_name='first_evaluations')
second_work_period = models.OneToOneField(GsocEvent, related_name='second_work_period')
second_evaluations = models.OneToOneField(GsocEvent, related_name='second_evaluations')
third_work_period = models.OneToOneField(GsocEvent, related_name='third_work_period')
final_week = models.OneToOneField(GsocEvent, related_name='final_week')
final_evaluations_mentor = models.OneToOneField(GsocEvent, related_name='final_evaluations_mentor')
post_program = models.OneToOneField(GsocEvent, related_name='post_program')
community_bonding_period = models.OneToOneField(GsocEvent, related_name='community_bonding_period')
coding_period = models.OneToOneField(GsocEvent, related_name='coding_period')
org_signup_open = models.OneToOneField(
GsocEvent, related_name='org_signup_open', on_delete=models.CASCADE)
org_approval = models.OneToOneField(
GsocEvent, related_name='org_approval', on_delete=models.CASCADE)
orgs_published = models.OneToOneField(
GsocEvent, related_name='org_published', on_delete=models.CASCADE)
student_signup_open = models.OneToOneField(
GsocEvent, related_name='student_signup_open', on_delete=models.CASCADE)
slot_request = models.OneToOneField(
GsocEvent, related_name='slot_request', on_delete=models.CASCADE)
slot_allocation_grace_period = models.OneToOneField(
GsocEvent, related_name='slot_allocation_grace_period',
on_delete=models.CASCADE)
project_acceptance = models.OneToOneField(
GsocEvent, related_name='project_acceptance', on_delete=models.CASCADE)
project_decisions_finalization = models.OneToOneField(
GsocEvent, related_name='project_decisions_finalization',
on_delete=models.CASCADE)
first_work_period = models.OneToOneField(
GsocEvent, related_name='first_work_period', on_delete=models.CASCADE)
first_evaluations = models.OneToOneField(
GsocEvent, related_name='first_evaluations', on_delete=models.CASCADE)
second_work_period = models.OneToOneField(
GsocEvent, related_name='second_work_period', on_delete=models.CASCADE)
second_evaluations = models.OneToOneField(
GsocEvent, related_name='second_evaluations', on_delete=models.CASCADE)
third_work_period = models.OneToOneField(
GsocEvent, related_name='third_work_period', on_delete=models.CASCADE)
final_week = models.OneToOneField(
GsocEvent, related_name='final_week', on_delete=models.CASCADE)
final_evaluations_mentor = models.OneToOneField(
GsocEvent, related_name='final_evaluations_mentor',
on_delete=models.CASCADE)
post_program = models.OneToOneField(
GsocEvent, related_name='post_program', on_delete=models.CASCADE)
community_bonding_period = models.OneToOneField(
GsocEvent, related_name='community_bonding_period',
on_delete=models.CASCADE)
coding_period = models.OneToOneField(
GsocEvent, related_name='coding_period', on_delete=models.CASCADE)
results_announced = models.DateField()
tax_forms_deadline = models.DateField()
first_payments = models.DateField()
Expand All @@ -64,7 +86,7 @@ def __str__(self):


class Feature(models.Model):
program = models.OneToOneField(Program)
program = models.OneToOneField(Program, on_delete=models.CASCADE)
student_finals_can_be_submitted = models.BooleanField()
org_payment_details_can_be_changed = models.BooleanField()
admins_can_register = models.BooleanField()
Expand Down Expand Up @@ -120,7 +142,7 @@ def __str__(self):


class ProgramStatistic(models.Model):
program = models.OneToOneField(Program)
program = models.OneToOneField(Program, on_delete=models.CASCADE)
number_of_lines_of_code = models.IntegerField()
homepage_start_button = models.CharField(max_length=100)
homepage_intro_paragraph = models.TextField()
Expand Down Expand Up @@ -180,7 +202,7 @@ class Project(models.Model):
name = models.CharField(max_length=100, primary_key=True)
summary = models.TextField(max_length=300, default='')
org = models.ForeignKey(Organization, on_delete=models.CASCADE)
student = models.OneToOneField(Student)
student = models.OneToOneField(Student, on_delete=models.CASCADE)
mentor = models.ForeignKey(Mentor, on_delete=models.CASCADE)
program = models.ForeignKey(Program, on_delete=models.CASCADE)

Expand Down
10 changes: 6 additions & 4 deletions meta_review/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Comment(models.Model):
diff = models.TextField(default=None, null=True)
created_at = models.DateTimeField(default=None, null=True)
last_edited_at = models.DateTimeField(default=None, null=True)
author = models.ForeignKey(Participant, null=True)
author = models.ForeignKey(Participant, null=True, on_delete=models.CASCADE)

# number of positive reactions received
pos = models.IntegerField(default=0, null=True)
Expand Down Expand Up @@ -92,6 +92,8 @@ class Reaction(models.Model):
id = models.TextField(default=None, primary_key=True)
created_at = models.DateTimeField(default=None, null=True)
content = models.TextField(default=None, null=True)
giver = models.ForeignKey(Participant, related_name='give', null=True)
receiver = models.ForeignKey(Participant, related_name='receive', null=True)
review = models.ForeignKey(Comment, null=True)
giver = models.ForeignKey(Participant, related_name='give', null=True,
on_delete=models.CASCADE)
receiver = models.ForeignKey(Participant, related_name='receive', null=True,
on_delete=models.CASCADE)
review = models.ForeignKey(Comment, null=True, on_delete=models.CASCADE)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
git-url-parse
django<2.0
django
django-distill
django-eventtools
git+https://gitlab.com/gitmate/open-source/IGitt.git@1fa5a0a21ea4fb8739d467c06972f748717adbdc
Expand Down

0 comments on commit bae1866

Please sign in to comment.