Browse Source

Remove Member.team_id (use Member.project_id instead)

pull/214/head
Pēteris Caune 6 years ago
parent
commit
d52d292889
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 19 additions and 4 deletions
  1. +17
    -0
      hc/accounts/migrations/0025_remove_member_team.py
  2. +1
    -2
      hc/accounts/models.py
  3. +1
    -2
      hc/test.py

+ 17
- 0
hc/accounts/migrations/0025_remove_member_team.py View File

@ -0,0 +1,17 @@
# Generated by Django 2.1.5 on 2019-01-22 08:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0024_auto_20190119_1540'),
]
operations = [
migrations.RemoveField(
model_name='member',
name='team',
),
]

+ 1
- 2
hc/accounts/models.py View File

@ -171,7 +171,7 @@ class Profile(models.Model):
def invite(self, user):
project = self.get_own_project()
Member.objects.create(team=self, user=user, project=project)
Member.objects.create(user=user, project=project)
# Switch the invited user over to the new team so they
# notice the new team on next visit:
@ -253,6 +253,5 @@ class Project(models.Model):
class Member(models.Model):
team = models.ForeignKey(Profile, models.CASCADE)
user = models.ForeignKey(User, models.CASCADE, related_name="memberships")
project = models.ForeignKey(Project, models.CASCADE)

+ 1
- 2
hc/test.py View File

@ -36,8 +36,7 @@ class BaseTestCase(TestCase):
self.bobs_profile.current_project = self.project
self.bobs_profile.save()
Member.objects.create(team=self.profile, user=self.bob,
project=self.project)
Member.objects.create(user=self.bob, project=self.project)
# Charlie should have no access to Alice's stuff
self.charlie = User(username="charlie", email="[email protected]")


Loading…
Cancel
Save